maidr 0.24.0__py3-none-any.whl → 0.25.1__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/api.py +6 -3
- maidr/core/maidr.py +8 -3
- {maidr-0.24.0.dist-info → maidr-0.25.1.dist-info}/METADATA +1 -1
- {maidr-0.24.0.dist-info → maidr-0.25.1.dist-info}/RECORD +7 -7
- {maidr-0.24.0.dist-info → maidr-0.25.1.dist-info}/LICENSE +0 -0
- {maidr-0.24.0.dist-info → maidr-0.25.1.dist-info}/WHEEL +0 -0
maidr/__init__.py
CHANGED
maidr/api.py
CHANGED
|
@@ -9,7 +9,6 @@ from matplotlib.container import BarContainer
|
|
|
9
9
|
from maidr.core import Maidr
|
|
10
10
|
from maidr.core.enum import PlotType
|
|
11
11
|
from maidr.core.figure_manager import FigureManager
|
|
12
|
-
from maidr.util.environment import Environment
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
def render(plot: Any) -> Tag:
|
|
@@ -18,7 +17,11 @@ def render(plot: Any) -> Tag:
|
|
|
18
17
|
return maidr.render()
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
def show(
|
|
20
|
+
def show(
|
|
21
|
+
plot: Any,
|
|
22
|
+
renderer: Literal["auto", "ipython", "browser"] = "auto",
|
|
23
|
+
clear_fig: bool = True,
|
|
24
|
+
) -> object:
|
|
22
25
|
ax = FigureManager.get_axes(plot)
|
|
23
26
|
if isinstance(ax, list):
|
|
24
27
|
for axes in ax:
|
|
@@ -26,7 +29,7 @@ def show(plot: Any, renderer: Literal["auto", "ipython", "browser"] = "auto") ->
|
|
|
26
29
|
return maidr.show(renderer)
|
|
27
30
|
else:
|
|
28
31
|
maidr = FigureManager.get_maidr(ax.get_figure())
|
|
29
|
-
return maidr.show(renderer)
|
|
32
|
+
return maidr.show(renderer, clear_fig=clear_fig)
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
def save_html(
|
maidr/core/maidr.py
CHANGED
|
@@ -8,6 +8,7 @@ import uuid
|
|
|
8
8
|
import webbrowser
|
|
9
9
|
from typing import Any, Literal
|
|
10
10
|
|
|
11
|
+
import matplotlib.pyplot as plt
|
|
11
12
|
from htmltools import HTML, HTMLDocument, Tag, tags
|
|
12
13
|
from lxml import etree
|
|
13
14
|
from matplotlib.figure import Figure
|
|
@@ -21,7 +22,8 @@ from maidr.util.environment import Environment
|
|
|
21
22
|
|
|
22
23
|
class Maidr:
|
|
23
24
|
"""
|
|
24
|
-
A class to handle the rendering and interaction
|
|
25
|
+
A class to handle the rendering and interaction
|
|
26
|
+
of matplotlib figures with additional metadata.
|
|
25
27
|
|
|
26
28
|
Attributes
|
|
27
29
|
----------
|
|
@@ -84,6 +86,7 @@ class Maidr:
|
|
|
84
86
|
def show(
|
|
85
87
|
self,
|
|
86
88
|
renderer: Literal["auto", "ipython", "browser"] = "auto",
|
|
89
|
+
clear_fig: bool = True,
|
|
87
90
|
) -> object:
|
|
88
91
|
"""
|
|
89
92
|
Preview the HTML content using the specified renderer.
|
|
@@ -99,6 +102,8 @@ class Maidr:
|
|
|
99
102
|
Environment.is_interactive_shell() and not Environment.is_notebook()
|
|
100
103
|
):
|
|
101
104
|
return self._open_plot_in_browser()
|
|
105
|
+
if clear_fig:
|
|
106
|
+
plt.close()
|
|
102
107
|
return html.show(renderer)
|
|
103
108
|
|
|
104
109
|
def clear(self):
|
|
@@ -241,7 +246,7 @@ class Maidr:
|
|
|
241
246
|
def _inject_plot(plot: HTML, maidr: str, maidr_id) -> Tag:
|
|
242
247
|
"""Embed the plot and associated MAIDR scripts into the HTML structure."""
|
|
243
248
|
# MAIDR_TS_CDN_URL = "http://localhost:8080/maidr.js" # DEMO URL
|
|
244
|
-
MAIDR_TS_CDN_URL = "https://cdn.jsdelivr.net/npm/maidr
|
|
249
|
+
MAIDR_TS_CDN_URL = "https://cdn.jsdelivr.net/npm/maidr/dist/maidr.js"
|
|
245
250
|
|
|
246
251
|
script = f"""
|
|
247
252
|
if (!document.querySelector('script[src="{MAIDR_TS_CDN_URL}"]'))
|
|
@@ -263,7 +268,7 @@ class Maidr:
|
|
|
263
268
|
base_html = tags.div(
|
|
264
269
|
tags.link(
|
|
265
270
|
rel="stylesheet",
|
|
266
|
-
href="https://cdn.jsdelivr.net/npm/maidr/dist/maidr_style.
|
|
271
|
+
href="https://cdn.jsdelivr.net/npm/maidr/dist/maidr_style.css",
|
|
267
272
|
),
|
|
268
273
|
tags.script(script, type="text/javascript"),
|
|
269
274
|
tags.div(plot),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: maidr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
maidr/__init__.py,sha256
|
|
2
|
-
maidr/api.py,sha256=
|
|
1
|
+
maidr/__init__.py,sha256=TAajoEHlYg-imPN5fvMAJZmUwY6Lc18YgvVeeKVOcFE,357
|
|
2
|
+
maidr/api.py,sha256=2PkvPDhpPFEHmM99-jFkXij07GgQ4Rj-KDZ-b_Krc5c,1734
|
|
3
3
|
maidr/core/__init__.py,sha256=WgxLpSEYMc4k3OyEOf1shOxfEq0ASzppEIZYmE91ThQ,25
|
|
4
4
|
maidr/core/context_manager.py,sha256=6cT7ZGOApSpC-SLD2XZWWU_H08i-nfv-JUlzXOtvWYw,3374
|
|
5
5
|
maidr/core/enum/__init__.py,sha256=9ee78L0dlxEx4ulUGVlD-J23UcUZmrGu0rXms54up3c,93
|
|
@@ -7,7 +7,7 @@ maidr/core/enum/library.py,sha256=e8ujT_L-McJWfoVJd1ty9K_2bwITnf1j0GPLsnAcHes,10
|
|
|
7
7
|
maidr/core/enum/maidr_key.py,sha256=ljG0omqzd8K8Yk213N7i7PXGvG-IOlnE5v7o6RoGJzc,795
|
|
8
8
|
maidr/core/enum/plot_type.py,sha256=pyfyIwlq3taqe2Z1sVUSbMsTp5QTvYBlZXsMMMclEVM,293
|
|
9
9
|
maidr/core/figure_manager.py,sha256=e6nI5pGqH0NM3yzt2jeiae4lrBlIOhkDN92GZJ3MNmk,3988
|
|
10
|
-
maidr/core/maidr.py,sha256=
|
|
10
|
+
maidr/core/maidr.py,sha256=6Sy9pbM4YxKh9hdpbPwk5GeoRTWLPaR_DDZQgEaVmP8,12731
|
|
11
11
|
maidr/core/plot/__init__.py,sha256=xDIpRGM-4DfaSSL3nKcXrjdMecCHJ6en4K4nA_fPefQ,83
|
|
12
12
|
maidr/core/plot/barplot.py,sha256=1HfoqyDGKIXkYQnCHN83Ye_faKpNQ3R4wjlbjD5jUyk,2092
|
|
13
13
|
maidr/core/plot/boxplot.py,sha256=FjXiRdMfNj2czKs0vr8hPXr5SSu1CowyL9ZdWGbcC6s,9353
|
|
@@ -37,7 +37,7 @@ maidr/util/mixin/extractor_mixin.py,sha256=oHtwpmS5kARvaLrSO3DKTPQxyFUw9nOcKN7rz
|
|
|
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.25.1.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
41
|
+
maidr-0.25.1.dist-info/METADATA,sha256=3FxK0W5YXUnTkQXKXeddmI8PLVA7icaWc6RO1bzaRkw,2688
|
|
42
|
+
maidr-0.25.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
43
|
+
maidr-0.25.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|