maidr 0.22.2__tar.gz → 0.23.1__tar.gz
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-0.22.2 → maidr-0.23.1}/PKG-INFO +1 -1
- {maidr-0.22.2 → maidr-0.23.1}/maidr/__init__.py +1 -1
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/barplot.py +2 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/grouped_barplot.py +1 -1
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/maidr_plot.py +22 -1
- {maidr-0.22.2 → maidr-0.23.1}/maidr/util/mixin/extractor_mixin.py +12 -0
- {maidr-0.22.2 → maidr-0.23.1}/pyproject.toml +1 -1
- {maidr-0.22.2 → maidr-0.23.1}/LICENSE +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/README.md +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/api.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/context_manager.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/enum/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/enum/library.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/enum/maidr_key.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/enum/plot_type.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/figure_manager.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/maidr.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/boxplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/heatmap.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/histogram.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/lineplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/maidr_plot_factory.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/core/plot/scatterplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/exception/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/exception/extraction_error.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/barplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/boxplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/clear.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/common.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/heatmap.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/highlight.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/histogram.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/lineplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/patch/scatterplot.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/util/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/util/environment.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/util/mixin/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/util/mixin/merger_mixin.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/widget/__init__.py +0 -0
- {maidr-0.22.2 → maidr-0.23.1}/maidr/widget/shiny.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: maidr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.1
|
|
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
|
|
@@ -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
|
|
@@ -24,7 +24,7 @@ class GroupedBarPlot(
|
|
|
24
24
|
grouped_ax_schema = {
|
|
25
25
|
MaidrKey.X.value: self.ax.get_xlabel(),
|
|
26
26
|
MaidrKey.Y.value: self.ax.get_ylabel(),
|
|
27
|
-
MaidrKey.FILL.value: self.
|
|
27
|
+
MaidrKey.FILL.value: self.ax.get_title(),
|
|
28
28
|
}
|
|
29
29
|
return self.merge_dict(base_ax_schema, grouped_ax_schema)
|
|
30
30
|
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|