maidr 0.22.2__py3-none-any.whl → 0.23.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maidr/__init__.py +1 -1
- maidr/core/plot/barplot.py +2 -0
- maidr/core/plot/maidr_plot.py +22 -1
- maidr/util/mixin/extractor_mixin.py +12 -0
- {maidr-0.22.2.dist-info → maidr-0.23.0.dist-info}/METADATA +1 -1
- {maidr-0.22.2.dist-info → maidr-0.23.0.dist-info}/RECORD +8 -8
- {maidr-0.22.2.dist-info → maidr-0.23.0.dist-info}/LICENSE +0 -0
- {maidr-0.22.2.dist-info → maidr-0.23.0.dist-info}/WHEEL +0 -0
maidr/__init__.py
CHANGED
maidr/core/plot/barplot.py
CHANGED
|
@@ -48,6 +48,8 @@ class BarPlot(MaidrPlot, ContainerExtractorMixin, LevelExtractorMixin, DictMerge
|
|
|
48
48
|
# Flatten all the `list[BarContainer]` to `list[Patch]`.
|
|
49
49
|
plot = [patch for container in plot for patch in container.patches]
|
|
50
50
|
level = self.extract_level(self.ax)
|
|
51
|
+
if len(level) == 0: # type: ignore
|
|
52
|
+
level = ["" for _ in range(len(plot))] # type: ignore
|
|
51
53
|
|
|
52
54
|
if len(plot) != len(level):
|
|
53
55
|
return None
|
maidr/core/plot/maidr_plot.py
CHANGED
|
@@ -68,9 +68,30 @@ class MaidrPlot(ABC):
|
|
|
68
68
|
"""Return the CSS selector for highlighting elements."""
|
|
69
69
|
return "g[maidr='true'] > path"
|
|
70
70
|
|
|
71
|
+
def extract_shared_xlabel(self, ax, y_threshold=0.2):
|
|
72
|
+
# First, try to get an xlabel from any shared axes.
|
|
73
|
+
siblings = ax.get_shared_x_axes().get_siblings(ax)
|
|
74
|
+
for shared_ax in siblings:
|
|
75
|
+
xlabel = shared_ax.get_xlabel()
|
|
76
|
+
if xlabel: # if non-empty
|
|
77
|
+
return xlabel
|
|
78
|
+
|
|
79
|
+
for text in ax.figure.texts:
|
|
80
|
+
if text.get_position()[1] < y_threshold:
|
|
81
|
+
label = text.get_text().strip()
|
|
82
|
+
if label:
|
|
83
|
+
return label
|
|
84
|
+
|
|
85
|
+
return ""
|
|
86
|
+
|
|
71
87
|
def _extract_axes_data(self) -> dict:
|
|
72
88
|
"""Extract the plot's axes data"""
|
|
73
|
-
|
|
89
|
+
x_labels = self.ax.get_xlabel()
|
|
90
|
+
if not x_labels:
|
|
91
|
+
x_labels = self.extract_shared_xlabel(self.ax)
|
|
92
|
+
if not x_labels:
|
|
93
|
+
x_labels = "X"
|
|
94
|
+
return {MaidrKey.X: x_labels, MaidrKey.Y: self.ax.get_ylabel()}
|
|
74
95
|
|
|
75
96
|
@abstractmethod
|
|
76
97
|
def _extract_plot_data(self) -> list | dict:
|
|
@@ -78,8 +78,20 @@ class LevelExtractorMixin:
|
|
|
78
78
|
elif MaidrKey.FILL == key:
|
|
79
79
|
level = [container.get_label() for container in ax.containers]
|
|
80
80
|
|
|
81
|
+
if len(level) == 0: # type: ignore
|
|
82
|
+
level = LevelExtractorMixin.extract_shared_xtick_labels(ax)
|
|
83
|
+
|
|
81
84
|
return level
|
|
82
85
|
|
|
86
|
+
@staticmethod
|
|
87
|
+
def extract_shared_xtick_labels(ax):
|
|
88
|
+
siblings = ax.get_shared_x_axes().get_siblings(ax)
|
|
89
|
+
for shared_ax in siblings:
|
|
90
|
+
labels = [label.get_text() for label in shared_ax.get_xticklabels()]
|
|
91
|
+
if any(labels):
|
|
92
|
+
return labels
|
|
93
|
+
return []
|
|
94
|
+
|
|
83
95
|
|
|
84
96
|
class LineExtractorMixin:
|
|
85
97
|
@staticmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: maidr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: Multimodal Access and Interactive Data Representations
|
|
5
5
|
License: GPL-3.0-or-later
|
|
6
6
|
Keywords: accessibility,visualization,sonification,braille,tactile,multimodal,data representation,blind,low vision,visual impairments
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
maidr/__init__.py,sha256=
|
|
1
|
+
maidr/__init__.py,sha256=Ljve4SYKQEgmUc2B-UKQtoN9Z376J0sElayLOlEgHuY,357
|
|
2
2
|
maidr/api.py,sha256=GNyYSF8jEOsqCY4ZWLw3hh6RmRDewkWh6DJbzWfEwOA,1721
|
|
3
3
|
maidr/core/__init__.py,sha256=WgxLpSEYMc4k3OyEOf1shOxfEq0ASzppEIZYmE91ThQ,25
|
|
4
4
|
maidr/core/context_manager.py,sha256=6cT7ZGOApSpC-SLD2XZWWU_H08i-nfv-JUlzXOtvWYw,3374
|
|
@@ -9,13 +9,13 @@ maidr/core/enum/plot_type.py,sha256=pyfyIwlq3taqe2Z1sVUSbMsTp5QTvYBlZXsMMMclEVM,
|
|
|
9
9
|
maidr/core/figure_manager.py,sha256=e6nI5pGqH0NM3yzt2jeiae4lrBlIOhkDN92GZJ3MNmk,3988
|
|
10
10
|
maidr/core/maidr.py,sha256=w27bsjX42uGZofaCDtMlZGNPYVMvg0mKU7r0xQFDeTY,12560
|
|
11
11
|
maidr/core/plot/__init__.py,sha256=xDIpRGM-4DfaSSL3nKcXrjdMecCHJ6en4K4nA_fPefQ,83
|
|
12
|
-
maidr/core/plot/barplot.py,sha256=
|
|
12
|
+
maidr/core/plot/barplot.py,sha256=1HfoqyDGKIXkYQnCHN83Ye_faKpNQ3R4wjlbjD5jUyk,2092
|
|
13
13
|
maidr/core/plot/boxplot.py,sha256=WuHrUy6CFZRBfVDjl9MU262mfLFR6DWF_2h4zN3wcMI,5881
|
|
14
14
|
maidr/core/plot/grouped_barplot.py,sha256=6D7KT1pjf7XP4XRERmRHYpXY83VikyGcGp-37qQZPEU,2101
|
|
15
15
|
maidr/core/plot/heatmap.py,sha256=yMS-31tS2GW4peds9LtZesMxmmTV_YfqYO5M_t5KasQ,2521
|
|
16
16
|
maidr/core/plot/histogram.py,sha256=QV5W-6ZJQQcZsrM91JJBX-ONktJzH7yg_et5_bBPfQQ,1525
|
|
17
17
|
maidr/core/plot/lineplot.py,sha256=NEsnreoJ2Qe7fcY7iPHbrJ7UgL1DnGyMmL_4fNcMaQI,3309
|
|
18
|
-
maidr/core/plot/maidr_plot.py,sha256=
|
|
18
|
+
maidr/core/plot/maidr_plot.py,sha256=B6hjsu-jSWlevEqJawgwjMOJr51nBBNh7yqJdSTkNhw,3681
|
|
19
19
|
maidr/core/plot/maidr_plot_factory.py,sha256=QGcHK_oquY_M2_KJVEtc5-rBAD-gm7KI1kSD7cduHzg,1691
|
|
20
20
|
maidr/core/plot/scatterplot.py,sha256=o0i0uS-wXK9ZrENxneoHbh3-u-2goRONp19Yu9QLsaY,1257
|
|
21
21
|
maidr/exception/__init__.py,sha256=PzaXoYBhyZxMDcJkuxJugDx7jZeseI0El6LpxIwXyG4,46
|
|
@@ -33,11 +33,11 @@ maidr/patch/scatterplot.py,sha256=kln6zZwjVsdQzICalo-RnBOJrx1BnIB2xYUwItHvSNY,52
|
|
|
33
33
|
maidr/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
maidr/util/environment.py,sha256=NJzbcFUCIk7OF29eIae8jyHax9p8fQgFLmxM6Af0fUY,4465
|
|
35
35
|
maidr/util/mixin/__init__.py,sha256=aGJZNhtWh77yIVPc7ipIZm1OajigjMtCWYKPuDWTC-c,217
|
|
36
|
-
maidr/util/mixin/extractor_mixin.py,sha256=
|
|
36
|
+
maidr/util/mixin/extractor_mixin.py,sha256=oHtwpmS5kARvaLrSO3DKTPQxyFUw9nOcKN7rzTj1q4g,5192
|
|
37
37
|
maidr/util/mixin/merger_mixin.py,sha256=V0qLw_6DUB7X6CQ3BCMpsCQX_ZuwAhoSTm_E4xAJFKM,712
|
|
38
38
|
maidr/widget/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
maidr/widget/shiny.py,sha256=wrrw2KAIpE_A6CNQGBtNHauR1DjenA_n47qlFXX9_rk,745
|
|
40
|
-
maidr-0.
|
|
41
|
-
maidr-0.
|
|
42
|
-
maidr-0.
|
|
43
|
-
maidr-0.
|
|
40
|
+
maidr-0.23.0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
41
|
+
maidr-0.23.0.dist-info/METADATA,sha256=wpNic98dvQs53YS3btM7WPNvNEXgnwYEnYcljNTNvN4,2688
|
|
42
|
+
maidr-0.23.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
43
|
+
maidr-0.23.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|