maidr 0.24.0__tar.gz → 0.25.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.
Files changed (43) hide show
  1. {maidr-0.24.0 → maidr-0.25.1}/PKG-INFO +1 -1
  2. {maidr-0.24.0 → maidr-0.25.1}/maidr/__init__.py +1 -1
  3. {maidr-0.24.0 → maidr-0.25.1}/maidr/api.py +6 -3
  4. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/maidr.py +8 -3
  5. {maidr-0.24.0 → maidr-0.25.1}/pyproject.toml +1 -1
  6. {maidr-0.24.0 → maidr-0.25.1}/LICENSE +0 -0
  7. {maidr-0.24.0 → maidr-0.25.1}/README.md +0 -0
  8. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/__init__.py +0 -0
  9. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/context_manager.py +0 -0
  10. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/enum/__init__.py +0 -0
  11. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/enum/library.py +0 -0
  12. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/enum/maidr_key.py +0 -0
  13. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/enum/plot_type.py +0 -0
  14. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/figure_manager.py +0 -0
  15. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/__init__.py +0 -0
  16. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/barplot.py +0 -0
  17. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/boxplot.py +0 -0
  18. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/grouped_barplot.py +0 -0
  19. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/heatmap.py +0 -0
  20. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/histogram.py +0 -0
  21. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/lineplot.py +0 -0
  22. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/maidr_plot.py +0 -0
  23. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/maidr_plot_factory.py +0 -0
  24. {maidr-0.24.0 → maidr-0.25.1}/maidr/core/plot/scatterplot.py +0 -0
  25. {maidr-0.24.0 → maidr-0.25.1}/maidr/exception/__init__.py +0 -0
  26. {maidr-0.24.0 → maidr-0.25.1}/maidr/exception/extraction_error.py +0 -0
  27. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/__init__.py +0 -0
  28. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/barplot.py +0 -0
  29. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/boxplot.py +0 -0
  30. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/clear.py +0 -0
  31. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/common.py +0 -0
  32. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/heatmap.py +0 -0
  33. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/highlight.py +0 -0
  34. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/histogram.py +0 -0
  35. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/lineplot.py +0 -0
  36. {maidr-0.24.0 → maidr-0.25.1}/maidr/patch/scatterplot.py +0 -0
  37. {maidr-0.24.0 → maidr-0.25.1}/maidr/util/__init__.py +0 -0
  38. {maidr-0.24.0 → maidr-0.25.1}/maidr/util/environment.py +0 -0
  39. {maidr-0.24.0 → maidr-0.25.1}/maidr/util/mixin/__init__.py +0 -0
  40. {maidr-0.24.0 → maidr-0.25.1}/maidr/util/mixin/extractor_mixin.py +0 -0
  41. {maidr-0.24.0 → maidr-0.25.1}/maidr/util/mixin/merger_mixin.py +0 -0
  42. {maidr-0.24.0 → maidr-0.25.1}/maidr/widget/__init__.py +0 -0
  43. {maidr-0.24.0 → maidr-0.25.1}/maidr/widget/shiny.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: maidr
3
- Version: 0.24.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,4 +1,4 @@
1
- __version__ = "0.24.0"
1
+ __version__ = "0.25.1"
2
2
 
3
3
  from .api import close, render, save_html, show, stacked
4
4
  from .core import Maidr
@@ -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(plot: Any, renderer: Literal["auto", "ipython", "browser"] = "auto") -> object:
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(
@@ -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 of matplotlib figures with additional metadata.
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-ts/dist/maidr.js"
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.min.css",
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),
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "maidr"
7
- version = "0.24.0"
7
+ version = "0.25.1"
8
8
  description = "Multimodal Access and Interactive Data Representations"
9
9
  authors = [
10
10
  "JooYoung Seo <jseo1005@illinois.edu>",
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