maidr 1.9.0__tar.gz → 1.11.0__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 (175) hide show
  1. maidr-1.11.0/.github/workflows/claude.yml +50 -0
  2. {maidr-1.9.0 → maidr-1.11.0}/CHANGELOG.md +17 -0
  3. {maidr-1.9.0 → maidr-1.11.0}/PKG-INFO +1 -1
  4. {maidr-1.9.0 → maidr-1.11.0}/docs/examples.qmd +120 -55
  5. {maidr-1.9.0 → maidr-1.11.0}/example/bar/example_bar_plot.ipynb +25 -18
  6. maidr-1.11.0/example/bar/matplotlib/example_mpl_bar_plot.py +21 -0
  7. maidr-1.11.0/example/bar/seaborn/example_sns_bar_plot.py +22 -0
  8. {maidr-1.9.0 → maidr-1.11.0}/example/box/example_box_plot.ipynb +53 -24
  9. {maidr-1.9.0 → maidr-1.11.0}/example/box/matplotlib/example_mpl_box.py +16 -10
  10. maidr-1.11.0/example/box/seaborn/example_sns_box.py +44 -0
  11. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/legacy_candlestick_example.py +7 -0
  12. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/mplfinance_candlestick_example.py +19 -1
  13. {maidr-1.9.0 → maidr-1.11.0}/example/count/example_count_plot.ipynb +11 -6
  14. maidr-1.11.0/example/count/seaborn/example_sns_count_plot.py +20 -0
  15. {maidr-1.9.0 → maidr-1.11.0}/example/dodged/matplotlib/example_mpl_dodged.py +5 -0
  16. {maidr-1.9.0 → maidr-1.11.0}/example/dodged/seaborn/example_sns_dodged.py +4 -0
  17. {maidr-1.9.0 → maidr-1.11.0}/example/facet-subplots/matplotlib/example_mpl_facet_bar_plot.py +4 -0
  18. {maidr-1.9.0 → maidr-1.11.0}/example/facet-subplots/matplotlib/example_mpl_facet_combined_plot.py +7 -0
  19. {maidr-1.9.0 → maidr-1.11.0}/example/facet-subplots/seaborn/example_sns_facet_bar_plot.py +4 -0
  20. {maidr-1.9.0 → maidr-1.11.0}/example/facet-subplots/seaborn/example_sns_facet_combined_plot.py +9 -0
  21. {maidr-1.9.0 → maidr-1.11.0}/example/flask/test_flask_app.py +9 -5
  22. {maidr-1.9.0 → maidr-1.11.0}/example/heatmap/example_heatmap_plot.ipynb +21 -10
  23. {maidr-1.9.0 → maidr-1.11.0}/example/heatmap/matplotlib/example_mpl_heatmap.py +4 -0
  24. maidr-1.11.0/example/heatmap/seaborn/example_sns_heatmap.py +21 -0
  25. {maidr-1.9.0 → maidr-1.11.0}/example/histogram/example_histogram_plot.ipynb +54 -22
  26. maidr-1.11.0/example/histogram/matplotlib/example_mpl_hist.py +25 -0
  27. {maidr-1.9.0 → maidr-1.11.0}/example/histogram/matplotlib/histogram_with_kde_matplotlib.py +7 -0
  28. maidr-1.11.0/example/histogram/seaborn/example_sns_hist.py +26 -0
  29. {maidr-1.9.0 → maidr-1.11.0}/example/histogram/seaborn/histogram_with_kde_seaborn.py +7 -0
  30. {maidr-1.9.0 → maidr-1.11.0}/example/kde/example_kde_plots.ipynb +79 -41
  31. {maidr-1.9.0 → maidr-1.11.0}/example/kde/matplotlib/multiple_kde_matplotlib.py +17 -10
  32. {maidr-1.9.0 → maidr-1.11.0}/example/kde/matplotlib/single_kde_matplotlib.py +15 -8
  33. {maidr-1.9.0 → maidr-1.11.0}/example/kde/seaborn/multiple_kde_seaborn.py +17 -10
  34. maidr-1.11.0/example/kde/seaborn/single_kde_seaborn.py +23 -0
  35. {maidr-1.9.0 → maidr-1.11.0}/example/line/example_line_plot.ipynb +28 -18
  36. {maidr-1.9.0 → maidr-1.11.0}/example/line/matplotlib/example_mpl_line.py +12 -7
  37. {maidr-1.9.0 → maidr-1.11.0}/example/line/seaborn/example_sns_line.py +10 -5
  38. {maidr-1.9.0 → maidr-1.11.0}/example/multilayer/example_mpl_multilayer.py +5 -0
  39. {maidr-1.9.0 → maidr-1.11.0}/example/multilayer/example_multilayer_plot.ipynb +8 -4
  40. {maidr-1.9.0 → maidr-1.11.0}/example/multiline/example_multiline_plot.ipynb +25 -20
  41. {maidr-1.9.0 → maidr-1.11.0}/example/multiline/matplotlib/example_mpl_multiline.py +13 -11
  42. {maidr-1.9.0 → maidr-1.11.0}/example/multiline/seaborn/example_sns_multiline.py +10 -5
  43. {maidr-1.9.0 → maidr-1.11.0}/example/multipanel/example_multipanel_plot.ipynb +22 -7
  44. {maidr-1.9.0 → maidr-1.11.0}/example/multipanel/matplotlib/example_mpl_multipanel.py +8 -0
  45. {maidr-1.9.0 → maidr-1.11.0}/example/multipanel/seaborn/example_sns_multipanel.py +8 -0
  46. {maidr-1.9.0 → maidr-1.11.0}/example/reg/example_reg_plots.ipynb +25 -14
  47. {maidr-1.9.0 → maidr-1.11.0}/example/reg/matplotlib/example_matplotlib_smooth_plot.py +5 -0
  48. {maidr-1.9.0 → maidr-1.11.0}/example/reg/seaborn/example_sns_reg.py +10 -4
  49. {maidr-1.9.0 → maidr-1.11.0}/example/scatter/example_scatter_plot.ipynb +28 -20
  50. maidr-1.11.0/example/scatter/matplotlib/example_mpl_scatter.py +24 -0
  51. maidr-1.11.0/example/scatter/seaborn/example_sns_scatter.py +25 -0
  52. {maidr-1.9.0 → maidr-1.11.0}/example/shiny/example_shiny_scatter.py +6 -0
  53. {maidr-1.9.0 → maidr-1.11.0}/example/stacked/matplotlib/example_mpl_stacked.py +4 -0
  54. {maidr-1.9.0 → maidr-1.11.0}/example/stacked/seaborn/example_sns_stacked.py +4 -0
  55. {maidr-1.9.0 → maidr-1.11.0}/example/streamlit/example_streamlit_app.py +16 -9
  56. {maidr-1.9.0 → maidr-1.11.0}/maidr/__init__.py +1 -1
  57. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/enum/maidr_key.py +1 -0
  58. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/candlestick.py +73 -104
  59. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/maidr_plot.py +11 -2
  60. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/mplfinance_barplot.py +5 -1
  61. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/mplfinance_lineplot.py +5 -1
  62. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/datetime_conversion.py +8 -18
  63. maidr-1.11.0/maidr/util/format_config.py +679 -0
  64. maidr-1.11.0/maidr/util/mixin/__init__.py +19 -0
  65. maidr-1.11.0/maidr/util/mixin/format_extractor_mixin.py +83 -0
  66. maidr-1.11.0/maidr/util/mplfinance_utils.py +117 -0
  67. {maidr-1.9.0 → maidr-1.11.0}/pyproject.toml +1 -1
  68. {maidr-1.9.0 → maidr-1.11.0}/uv.lock +7 -1
  69. maidr-1.9.0/example/bar/matplotlib/example_mpl_bar_plot.py +0 -18
  70. maidr-1.9.0/example/bar/seaborn/example_sns_bar_plot.py +0 -19
  71. maidr-1.9.0/example/box/seaborn/example_sns_box.py +0 -42
  72. maidr-1.9.0/example/count/seaborn/example_sns_count_plot.py +0 -16
  73. maidr-1.9.0/example/heatmap/seaborn/example_sns_heatmap.py +0 -16
  74. maidr-1.9.0/example/histogram/matplotlib/example_mpl_hist.py +0 -19
  75. maidr-1.9.0/example/histogram/seaborn/example_sns_hist.py +0 -21
  76. maidr-1.9.0/example/kde/seaborn/single_kde_seaborn.py +0 -15
  77. maidr-1.9.0/example/scatter/matplotlib/example_mpl_scatter.py +0 -20
  78. maidr-1.9.0/example/scatter/seaborn/example_sns_scatter.py +0 -21
  79. maidr-1.9.0/maidr/util/mixin/__init__.py +0 -8
  80. maidr-1.9.0/maidr/util/mplfinance_utils.py +0 -415
  81. {maidr-1.9.0 → maidr-1.11.0}/.commitlintrc.cjs +0 -0
  82. {maidr-1.9.0 → maidr-1.11.0}/.editorconfig +0 -0
  83. {maidr-1.9.0 → maidr-1.11.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  84. {maidr-1.9.0 → maidr-1.11.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  85. {maidr-1.9.0 → maidr-1.11.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  86. {maidr-1.9.0 → maidr-1.11.0}/.github/copilot-instructions.md +0 -0
  87. {maidr-1.9.0 → maidr-1.11.0}/.github/workflows/ci.yml +0 -0
  88. {maidr-1.9.0 → maidr-1.11.0}/.github/workflows/docs.yml +0 -0
  89. {maidr-1.9.0 → maidr-1.11.0}/.github/workflows/release.yml +0 -0
  90. {maidr-1.9.0 → maidr-1.11.0}/.gitignore +0 -0
  91. {maidr-1.9.0 → maidr-1.11.0}/.pre-commit-config.yaml +0 -0
  92. {maidr-1.9.0 → maidr-1.11.0}/.vscode/extensions.json +0 -0
  93. {maidr-1.9.0 → maidr-1.11.0}/.vscode/settings.json +0 -0
  94. {maidr-1.9.0 → maidr-1.11.0}/CONDUCT.md +0 -0
  95. {maidr-1.9.0 → maidr-1.11.0}/CONTRIBUTING.md +0 -0
  96. {maidr-1.9.0 → maidr-1.11.0}/LICENSE +0 -0
  97. {maidr-1.9.0 → maidr-1.11.0}/README.md +0 -0
  98. {maidr-1.9.0 → maidr-1.11.0}/docs/.gitignore +0 -0
  99. {maidr-1.9.0 → maidr-1.11.0}/docs/CNAME +0 -0
  100. {maidr-1.9.0 → maidr-1.11.0}/docs/_environment +0 -0
  101. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/machow/interlinks/.gitignore +0 -0
  102. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/machow/interlinks/_extension.yml +0 -0
  103. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/machow/interlinks/interlinks.lua +0 -0
  104. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/shafayetShafee/line-highlight/_extension.yml +0 -0
  105. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/shafayetShafee/line-highlight/line-highlight.lua +0 -0
  106. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/shafayetShafee/line-highlight/resources/css/line-highlight.css +0 -0
  107. {maidr-1.9.0 → maidr-1.11.0}/docs/_extensions/shafayetShafee/line-highlight/resources/js/line-highlight.js +0 -0
  108. {maidr-1.9.0 → maidr-1.11.0}/docs/_quarto.yml +0 -0
  109. {maidr-1.9.0 → maidr-1.11.0}/docs/index.qmd +0 -0
  110. {maidr-1.9.0 → maidr-1.11.0}/docs/styles.css +0 -0
  111. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/test_data_daily_current_year.csv +0 -0
  112. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/test_data_daily_mixed_years.csv +0 -0
  113. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/test_data_hourly.csv +0 -0
  114. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/test_data_minute.csv +0 -0
  115. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/test_data_weekly.csv +0 -0
  116. {maidr-1.9.0 → maidr-1.11.0}/example/candle_stick/volcandat.csv +0 -0
  117. {maidr-1.9.0 → maidr-1.11.0}/example/quarto/demo.qmd +0 -0
  118. {maidr-1.9.0 → maidr-1.11.0}/maidr/api.py +0 -0
  119. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/__init__.py +0 -0
  120. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/context_manager.py +0 -0
  121. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/enum/__init__.py +0 -0
  122. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/enum/library.py +0 -0
  123. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/enum/plot_type.py +0 -0
  124. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/enum/smooth_keywords.py +0 -0
  125. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/figure_manager.py +0 -0
  126. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/maidr.py +0 -0
  127. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/__init__.py +0 -0
  128. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/barplot.py +0 -0
  129. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/boxplot.py +0 -0
  130. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/grouped_barplot.py +0 -0
  131. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/heatmap.py +0 -0
  132. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/histogram.py +0 -0
  133. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/lineplot.py +0 -0
  134. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/maidr_plot_factory.py +0 -0
  135. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/regplot.py +0 -0
  136. {maidr-1.9.0 → maidr-1.11.0}/maidr/core/plot/scatterplot.py +0 -0
  137. {maidr-1.9.0 → maidr-1.11.0}/maidr/exception/__init__.py +0 -0
  138. {maidr-1.9.0 → maidr-1.11.0}/maidr/exception/extraction_error.py +0 -0
  139. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/__init__.py +0 -0
  140. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/barplot.py +0 -0
  141. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/boxplot.py +0 -0
  142. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/candlestick.py +0 -0
  143. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/clear.py +0 -0
  144. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/common.py +0 -0
  145. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/heatmap.py +0 -0
  146. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/highlight.py +0 -0
  147. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/histogram.py +0 -0
  148. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/kdeplot.py +0 -0
  149. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/lineplot.py +0 -0
  150. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/mplfinance.py +0 -0
  151. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/regplot.py +0 -0
  152. {maidr-1.9.0 → maidr-1.11.0}/maidr/patch/scatterplot.py +0 -0
  153. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/__init__.py +0 -0
  154. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/dedup_utils.py +0 -0
  155. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/environment.py +0 -0
  156. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/mixin/extractor_mixin.py +0 -0
  157. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/mixin/merger_mixin.py +0 -0
  158. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/plot_detection.py +0 -0
  159. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/regression_line_utils.py +0 -0
  160. {maidr-1.9.0 → maidr-1.11.0}/maidr/util/svg_utils.py +0 -0
  161. {maidr-1.9.0 → maidr-1.11.0}/maidr/widget/__init__.py +0 -0
  162. {maidr-1.9.0 → maidr-1.11.0}/maidr/widget/shiny.py +0 -0
  163. {maidr-1.9.0 → maidr-1.11.0}/tests/__init__.py +0 -0
  164. {maidr-1.9.0 → maidr-1.11.0}/tests/conftest.py +0 -0
  165. {maidr-1.9.0 → maidr-1.11.0}/tests/core/__init__.py +0 -0
  166. {maidr-1.9.0 → maidr-1.11.0}/tests/core/enum/__init__.py +0 -0
  167. {maidr-1.9.0 → maidr-1.11.0}/tests/core/plot/__init__.py +0 -0
  168. {maidr-1.9.0 → maidr-1.11.0}/tests/core/test_figure_manager.py +0 -0
  169. {maidr-1.9.0 → maidr-1.11.0}/tests/core/test_maidr_plot.py +0 -0
  170. {maidr-1.9.0 → maidr-1.11.0}/tests/core/test_maidr_plot_factory.py +0 -0
  171. {maidr-1.9.0 → maidr-1.11.0}/tests/fixture/__init__.py +0 -0
  172. {maidr-1.9.0 → maidr-1.11.0}/tests/fixture/library_factory.py +0 -0
  173. {maidr-1.9.0 → maidr-1.11.0}/tests/fixture/matplotlib_factory.py +0 -0
  174. {maidr-1.9.0 → maidr-1.11.0}/tests/fixture/seaborn_factory.py +0 -0
  175. {maidr-1.9.0 → maidr-1.11.0}/tox.ini +0 -0
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -1,6 +1,23 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v1.11.0 (2026-02-04)
5
+
6
+ ### Features
7
+
8
+ - Include format configuration from plot api ([#262](https://github.com/xability/py-maidr/pull/262),
9
+ [`59eb82f`](https://github.com/xability/py-maidr/commit/59eb82f880d370eab4cf437e22dee3cd4856158c))
10
+
11
+
12
+ ## v1.10.0 (2026-01-31)
13
+
14
+ ### Features
15
+
16
+ - Remove candlestick formatting and add ylabel to dodged plots
17
+ ([#260](https://github.com/xability/py-maidr/pull/260),
18
+ [`70b2626`](https://github.com/xability/py-maidr/commit/70b2626bb31e109e8cdb29051f809fe03bfb6275))
19
+
20
+
4
21
  ## v1.9.0 (2025-10-31)
5
22
 
6
23
  ### Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maidr
3
- Version: 1.9.0
3
+ Version: 1.11.0
4
4
  Summary: Multimodal Access and Interactive Data Representations
5
5
  Project-URL: Homepage, https://xability.github.io/py-maidr
6
6
  Project-URL: Repository, https://github.com/xability/py-maidr
@@ -33,17 +33,18 @@ import maidr #<<
33
33
  penguins = sns.load_dataset("penguins")
34
34
 
35
35
  # Create a bar plot showing the average body mass of penguins by species
36
- plt.figure(figsize=(6, 6))
36
+ fig, ax = plt.subplots(figsize=(6, 6))
37
37
 
38
38
  # Assign the plot to a variable #<<
39
39
  bar_plot = sns.barplot( #<<
40
- x="species", y="body_mass_g", data=penguins, errorbar="sd", palette="Blues_d"
40
+ x="species", y="body_mass_g", data=penguins, errorbar="sd", palette="Blues_d", ax=ax
41
41
  )
42
- plt.title("Average Body Mass of Penguins by Species")
43
- plt.xlabel("Species")
44
- plt.ylabel("Body Mass (g)")
42
+ ax.set_title("Average Body Mass of Penguins by Species")
43
+ ax.set_xlabel("Species")
44
+ ax.set_ylabel("Body Mass (g)")
45
45
 
46
- # plt.show()
46
+ # Add number formatter for better screen reader output
47
+ ax.yaxis.set_major_formatter("{x:,.0f}")
47
48
 
48
49
  # Use maidr.show() to display your plot #<<
49
50
  maidr.show(bar_plot) #<<
@@ -65,14 +66,16 @@ import maidr #<<
65
66
  titanic = sns.load_dataset("titanic")
66
67
 
67
68
  # Create a count plot
68
- plt.figure(figsize=(6, 6))
69
- count_plot = sns.countplot(x="class", data=titanic, palette="viridis") #<<
69
+ fig, ax = plt.subplots(figsize=(6, 6))
70
+ count_plot = sns.countplot(x="class", data=titanic, palette="viridis", ax=ax) #<<
70
71
 
71
- plt.title("Passenger Class Distribution on the Titanic")
72
- plt.xlabel("Passenger Class")
73
- plt.ylabel("Count")
72
+ ax.set_title("Passenger Class Distribution on the Titanic")
73
+ ax.set_xlabel("Passenger Class")
74
+ ax.set_ylabel("Count")
75
+
76
+ # Add number formatter for better screen reader output
77
+ ax.yaxis.set_major_formatter("{x:.0f}")
74
78
 
75
- # plt.show()
76
79
  maidr.show(count_plot) #<<
77
80
  ```
78
81
 
@@ -112,6 +115,9 @@ ax.set_ylabel("Average Body Mass")
112
115
  ax.set_title("Number of penguins with above average body mass")
113
116
  ax.legend(loc="upper right")
114
117
 
118
+ # Add number formatter for better screen reader output
119
+ ax.yaxis.set_major_formatter("{x:.0f}")
120
+
115
121
  maidr.show(p) #<<
116
122
  ```
117
123
 
@@ -152,9 +158,13 @@ for offset, (category, counts) in zip(offsets, weight_counts.items()):
152
158
  ax.set_xticks(x)
153
159
  ax.set_xticklabels(species)
154
160
  ax.set_xlabel("Species")
161
+ ax.set_ylabel("Weight")
155
162
  ax.set_title("Dodged Bar Plot: Penguin Weight Counts")
156
163
  ax.legend(loc="upper right")
157
164
 
165
+ # Add number formatter for better screen reader output
166
+ ax.yaxis.set_major_formatter("{x:.0f}")
167
+
158
168
  # Show plot using maidr.show
159
169
  maidr.show(p) #<<
160
170
  ```
@@ -178,15 +188,18 @@ iris = sns.load_dataset("iris")
178
188
  petal_lengths = iris["petal_length"]
179
189
 
180
190
  # Plot a histogram of the petal lengths
181
- plt.figure(figsize=(6, 6))
191
+ fig, ax = plt.subplots(figsize=(6, 6))
182
192
 
183
- hist_plot = sns.histplot(petal_lengths, kde=True, color="blue", binwidth=0.5) #<<
193
+ hist_plot = sns.histplot(petal_lengths, kde=True, color="blue", binwidth=0.5, ax=ax) #<<
184
194
 
185
- plt.title("Petal Lengths in Iris Dataset")
186
- plt.xlabel("Petal Length (cm)")
187
- plt.ylabel("Frequency")
195
+ ax.set_title("Petal Lengths in Iris Dataset")
196
+ ax.set_xlabel("Petal Length (cm)")
197
+ ax.set_ylabel("Frequency")
198
+
199
+ # Add number formatters for better screen reader output
200
+ ax.xaxis.set_major_formatter("{x:.1f}")
201
+ ax.yaxis.set_major_formatter("{x:.0f}")
188
202
 
189
- # plt.show()
190
203
  maidr.show(hist_plot) #<<
191
204
  ```
192
205
 
@@ -207,14 +220,17 @@ np.random.seed(42)
207
220
  data = np.random.randn(500)
208
221
 
209
222
  # Create a KDE plot
210
- plt.figure(figsize=(6, 6))
211
- kde_plot = sns.kdeplot(data, fill=True, color="blue") #<<
223
+ fig, ax = plt.subplots(figsize=(6, 6))
224
+ kde_plot = sns.kdeplot(data, color="blue", ax=ax) #<<
212
225
 
213
- plt.title("KDE Plot of Random Data")
214
- plt.xlabel("Value")
215
- plt.ylabel("Density")
226
+ ax.set_title("KDE Plot of Random Data")
227
+ ax.set_xlabel("Value")
228
+ ax.set_ylabel("Density")
229
+
230
+ # Add number formatters for better screen reader output
231
+ ax.xaxis.set_major_formatter("{x:.1f}")
232
+ ax.yaxis.set_major_formatter("{x:.3f}")
216
233
 
217
- # plt.show()
218
234
  maidr.show(kde_plot) #<<
219
235
  ```
220
236
 
@@ -238,7 +254,7 @@ tips = sns.load_dataset("tips") #<<
238
254
  subset_data = tips[tips["day"] == "Thur"]
239
255
 
240
256
  # Create a line plot
241
- plt.figure(figsize=(6, 6))
257
+ fig, ax = plt.subplots(figsize=(6, 6))
242
258
  line_plot = sns.lineplot( #<<
243
259
  data=subset_data,
244
260
  x="total_bill",
@@ -246,12 +262,16 @@ line_plot = sns.lineplot( #<<
246
262
  markers=True,
247
263
  style="day",
248
264
  legend=False,
265
+ ax=ax,
249
266
  )
250
- plt.title("Tips vs Total Bill (Thursday)")
251
- plt.xlabel("Total Bill")
252
- plt.ylabel("Tip")
267
+ ax.set_title("Tips vs Total Bill (Thursday)")
268
+ ax.set_xlabel("Total Bill")
269
+ ax.set_ylabel("Tip")
270
+
271
+ # Add currency formatters for better screen reader output
272
+ ax.xaxis.set_major_formatter("${x:.2f}")
273
+ ax.yaxis.set_major_formatter("${x:.2f}")
253
274
 
254
- # plt.show()
255
275
  maidr.show(line_plot) #<<
256
276
  ```
257
277
 
@@ -282,17 +302,21 @@ data = pd.DataFrame(
282
302
  )
283
303
 
284
304
  # Create the plot
285
- plt.figure(figsize=(6, 6))
305
+ fig, ax = plt.subplots(figsize=(6, 6))
286
306
 
287
307
  # Use seaborn lineplot for multiple lines
288
308
  lineplot = sns.lineplot(
289
- x="x", y="y", hue="series", style="series", markers=True, dashes=True, data=data
309
+ x="x", y="y", hue="series", style="series", markers=True, dashes=True, data=data, ax=ax
290
310
  )
291
311
 
292
312
  # Customize the plot
293
- plt.title("Seaborn Multiline Plot")
294
- plt.xlabel("X values")
295
- plt.ylabel("Y values")
313
+ ax.set_title("Seaborn Multiline Plot")
314
+ ax.set_xlabel("X values")
315
+ ax.set_ylabel("Y values")
316
+
317
+ # Add number formatters for better screen reader output
318
+ ax.xaxis.set_major_formatter("{x:.0f}")
319
+ ax.yaxis.set_major_formatter("{x:.0f}")
296
320
 
297
321
  # Display the plot using maidr
298
322
  maidr.show(lineplot) #<<
@@ -313,9 +337,14 @@ import maidr #<<
313
337
  glue = sns.load_dataset("glue").pivot(index="Model", columns="Task", values="Score")
314
338
 
315
339
  # Plot a heatmap
316
- plt.figure(figsize=(8, 8))
317
- heatmap = sns.heatmap(glue, annot=True, fill_label="Score") #<<
318
- plt.title("Model Scores by Task")
340
+ fig, ax = plt.subplots(figsize=(8, 8))
341
+ heatmap = sns.heatmap(glue, annot=True, fill_label="Score", ax=ax) #<<
342
+ ax.set_title("Model Scores by Task")
343
+
344
+ # Add number formatter for colorbar for better screen reader output
345
+ cbar = heatmap.collections[0].colorbar
346
+ if cbar:
347
+ cbar.ax.yaxis.set_major_formatter("{x:.1f}")
319
348
 
320
349
  # Show the plot
321
350
  # plt.show()
@@ -338,11 +367,14 @@ import maidr #<<
338
367
  iris = load_dataset("iris")
339
368
 
340
369
  # Create the horizontal boxplot
341
- horz_box_plot = sns.boxplot(x="petal_length", y="species", data=iris, orient="h") #<<
342
- plt.ylabel("Species")
343
- plt.xlabel("Petal Length")
344
- plt.title("Petal Length by Species from Iris Dataset")
345
- # plt.show()
370
+ fig, ax = plt.subplots()
371
+ horz_box_plot = sns.boxplot(x="petal_length", y="species", data=iris, orient="h", ax=ax) #<<
372
+ ax.set_ylabel("Species")
373
+ ax.set_xlabel("Petal Length (cm)")
374
+ ax.set_title("Petal Length by Species from Iris Dataset")
375
+
376
+ # Add number formatter for better screen reader output
377
+ ax.xaxis.set_major_formatter("{x:.1f}")
346
378
 
347
379
  # Show the plot
348
380
  maidr.show(horz_box_plot) #<<
@@ -359,17 +391,21 @@ import seaborn as sns
359
391
  import maidr #<<
360
392
 
361
393
  # Create a scatter plot
394
+ fig, ax = plt.subplots()
362
395
  scatter_plot = sns.scatterplot( #<<
363
- data=iris, x="sepal_length", y="sepal_width", hue="species"
396
+ data=iris, x="sepal_length", y="sepal_width", hue="species", ax=ax
364
397
  )
365
398
 
366
- # Adding title and labels (optional)
367
- plt.title("Iris Sepal Length vs Sepal Width")
368
- plt.xlabel("Sepal Length")
369
- plt.ylabel("Sepal Width")
399
+ # Adding title and labels
400
+ ax.set_title("Iris Sepal Length vs Sepal Width")
401
+ ax.set_xlabel("Sepal Length (cm)")
402
+ ax.set_ylabel("Sepal Width (cm)")
403
+
404
+ # Add number formatters for better screen reader output
405
+ ax.xaxis.set_major_formatter("{x:.1f}")
406
+ ax.yaxis.set_major_formatter("{x:.1f}")
370
407
 
371
408
  # Show the plot
372
- # plt.show()
373
409
  maidr.show(scatter_plot) #<<
374
410
  ```
375
411
 
@@ -391,19 +427,23 @@ x = np.linspace(0, 10, 50)
391
427
  y = 2 * x + 1 + np.random.normal(0, 2, 50)
392
428
 
393
429
  # Create a regression plot
394
- plt.figure(figsize=(6, 6))
430
+ fig, ax = plt.subplots(figsize=(6, 6))
395
431
  reg_plot = sns.regplot(
396
432
  x=x,
397
433
  y=y,
398
434
  scatter_kws={"s": 50, "alpha": 0.7},
399
435
  line_kws={"color": "red", "lw": 2},
436
+ ax=ax,
400
437
  ) #<<
401
438
 
402
- plt.title("Regression Plot with Fitted Line")
403
- plt.xlabel("X values")
404
- plt.ylabel("Y values")
439
+ ax.set_title("Regression Plot with Fitted Line")
440
+ ax.set_xlabel("X values")
441
+ ax.set_ylabel("Y values")
442
+
443
+ # Add number formatters for better screen reader output
444
+ ax.xaxis.set_major_formatter("{x:.1f}")
445
+ ax.yaxis.set_major_formatter("{x:.2f}")
405
446
 
406
- # plt.show()
407
447
  maidr.show(reg_plot) #<<
408
448
  ```
409
449
 
@@ -447,6 +487,11 @@ lines1, labels1 = ax1.get_legend_handles_labels()
447
487
  lines2, labels2 = ax2.get_legend_handles_labels()
448
488
  ax1.legend(lines1 + lines2, labels1 + labels2, loc="upper left")
449
489
 
490
+ # Add number formatters for better screen reader output
491
+ ax1.xaxis.set_major_formatter("{x:.0f}")
492
+ ax1.yaxis.set_major_formatter("{x:.0f}")
493
+ ax2.yaxis.set_major_formatter("{x:.0f}")
494
+
450
495
  # Adjust layout
451
496
  fig.tight_layout()
452
497
 
@@ -507,6 +552,12 @@ axs[2].set_title("Bar Plot 2: Random Values") # Fixed the typo in the title
507
552
  axs[2].set_xlabel("Categories")
508
553
  axs[2].set_ylabel("Values")
509
554
 
555
+ # Add number formatters for better screen reader output
556
+ axs[0].xaxis.set_major_formatter("{x:.0f}")
557
+ axs[0].yaxis.set_major_formatter("{x:.0f}")
558
+ axs[1].yaxis.set_major_formatter("{x:.1f}")
559
+ axs[2].yaxis.set_major_formatter("{x:.1f}")
560
+
510
561
  # Adjust layout to prevent overlap
511
562
  plt.tight_layout()
512
563
 
@@ -566,6 +617,10 @@ fig.text(
566
617
  # Add a common title
567
618
  fig.suptitle("Facet Plot: Bar Charts by Condition", fontsize=16)
568
619
 
620
+ # Add number formatters for better screen reader output
621
+ for ax in axs:
622
+ ax.yaxis.set_major_formatter("{x:.1f}")
623
+
569
624
  # Adjust layout
570
625
  plt.tight_layout(rect=(0.08, 0.08, 0.98, 0.95))
571
626
 
@@ -580,6 +635,7 @@ maidr.show(fig) #<<
580
635
 
581
636
  import mplfinance as mpf
582
637
  import pandas as pd
638
+ import matplotlib.dates as mdates
583
639
 
584
640
  import maidr #<<
585
641
 
@@ -587,17 +643,26 @@ import maidr #<<
587
643
  daily = pd.read_csv("../example/candle_stick/volcandat.csv", index_col=0, parse_dates=True)
588
644
 
589
645
  # Create the candlestick chart with moving averages and volume
590
- fig, ax = mpf.plot(
646
+ fig, axlist = mpf.plot(
591
647
  daily,
592
648
  type="candle",
593
649
  volume=True,
594
650
  mav = (3,6,9),
595
651
  returnfig=True,
596
- ylabel="Price ($)",
652
+ ylabel="Price",
597
653
  ylabel_lower="Volume",
598
654
  xlabel="Date",
599
655
  title="Stock Price with Volume",
600
656
  ) #<<
657
+
658
+ # Add formatters for better screen reader output
659
+ # Price axis - Currency format
660
+ axlist[0].yaxis.set_major_formatter("${x:,.2f}")
661
+ # Date axis - Custom date format like "Nov 18, 2016"
662
+ axlist[0].xaxis.set_major_formatter(mdates.DateFormatter("%b %d, %Y"))
663
+ # Volume axis - Integer with thousands separator
664
+ axlist[2].yaxis.set_major_formatter("{x:,.0f}")
665
+
601
666
  fig.tight_layout()
602
667
 
603
668
  # Display with maidr
@@ -19,7 +19,7 @@
19
19
  },
20
20
  {
21
21
  "cell_type": "code",
22
- "execution_count": 1,
22
+ "execution_count": null,
23
23
  "metadata": {},
24
24
  "outputs": [
25
25
  {
@@ -48,29 +48,32 @@
48
48
  }
49
49
  ],
50
50
  "source": [
51
- "\n",
52
51
  "import matplotlib.pyplot as plt\n",
53
- "import maidr\n",
54
52
  "import seaborn as sns\n",
55
53
  "\n",
54
+ "import maidr\n",
55
+ "\n",
56
56
  "# Load dataset\n",
57
57
  "tips = sns.load_dataset(\"tips\")\n",
58
58
  "\n",
59
59
  "# Create a bar plot\n",
60
60
  "cut_counts = tips[\"day\"].value_counts()\n",
61
- "plt.figure(figsize=(10, 6))\n",
62
- "b_plot = plt.bar(cut_counts.index, list(cut_counts.values), color=\"skyblue\")\n",
63
- "plt.title(\"The Number of Tips by Day\")\n",
64
- "plt.xlabel(\"Day\")\n",
65
- "plt.ylabel(\"Count\")\n",
61
+ "fig, ax = plt.subplots(figsize=(10, 6))\n",
62
+ "b_plot = ax.bar(cut_counts.index, list(cut_counts.values), color=\"skyblue\")\n",
63
+ "ax.set_title(\"The Number of Tips by Day\")\n",
64
+ "ax.set_xlabel(\"Day\")\n",
65
+ "ax.set_ylabel(\"Count\")\n",
66
+ "\n",
67
+ "# Add number formatter to y-axis for better screen reader output\n",
68
+ "# This formats values with no decimal places (integer counts)\n",
69
+ "ax.yaxis.set_major_formatter(\"{x:.2f}\")\n",
66
70
  "\n",
67
- "# plt.show()\n",
68
- "maidr.show(b_plot)"
71
+ "maidr.show(b_plot)\n"
69
72
  ]
70
73
  },
71
74
  {
72
75
  "cell_type": "code",
73
- "execution_count": 5,
76
+ "execution_count": null,
74
77
  "metadata": {},
75
78
  "outputs": [
76
79
  {
@@ -91,22 +94,26 @@
91
94
  ],
92
95
  "source": [
93
96
  "import matplotlib.pyplot as plt\n",
94
- "import maidr\n",
95
97
  "import seaborn as sns\n",
96
98
  "\n",
99
+ "import maidr\n",
100
+ "\n",
97
101
  "# Load the penguins dataset\n",
98
102
  "penguins = sns.load_dataset(\"penguins\")\n",
99
103
  "\n",
100
104
  "# Create a bar plot showing the average body mass of penguins by species\n",
101
- "plt.figure(figsize=(10, 6))\n",
105
+ "fig, ax = plt.subplots(figsize=(10, 6))\n",
102
106
  "b_plot = sns.barplot(\n",
103
- " x=\"species\", y=\"body_mass_g\", data=penguins, errorbar=\"sd\", palette=\"Blues_d\"\n",
107
+ " x=\"species\", y=\"body_mass_g\", data=penguins, errorbar=\"sd\", palette=\"Blues_d\", ax=ax\n",
104
108
  ")\n",
105
- "plt.title(\"Average Body Mass of Penguins by Species\")\n",
106
- "plt.xlabel(\"Species\")\n",
107
- "plt.ylabel(\"Body Mass (g)\")\n",
109
+ "ax.set_title(\"Average Body Mass of Penguins by Species\")\n",
110
+ "ax.set_xlabel(\"Species\")\n",
111
+ "ax.set_ylabel(\"Body Mass (g)\")\n",
112
+ "\n",
113
+ "# Add number formatter to y-axis for better screen reader output\n",
114
+ "# Body mass values with thousands separator (e.g., \"4,500\")\n",
115
+ "ax.yaxis.set_major_formatter(\"{x:,.0f}\")\n",
108
116
  "\n",
109
- "# plt.show()\n",
110
117
  "maidr.show(b_plot)\n"
111
118
  ]
112
119
  },
@@ -0,0 +1,21 @@
1
+ import matplotlib.pyplot as plt
2
+ import seaborn as sns
3
+
4
+ import maidr
5
+
6
+ # Load dataset
7
+ tips = sns.load_dataset("tips")
8
+
9
+ # Create a bar plot
10
+ cut_counts = tips["day"].value_counts()
11
+ fig, ax = plt.subplots(figsize=(10, 6))
12
+ b_plot = ax.bar(cut_counts.index, list(cut_counts.values), color="skyblue")
13
+ ax.set_title("The Number of Tips by Day")
14
+ ax.set_xlabel("Day")
15
+ ax.set_ylabel("Count")
16
+
17
+ # Add number formatter to y-axis for better screen reader output
18
+ # This formats values with no decimal places (integer counts)
19
+ ax.yaxis.set_major_formatter("{x:.2f}")
20
+
21
+ maidr.show(b_plot)
@@ -0,0 +1,22 @@
1
+ import matplotlib.pyplot as plt
2
+ import seaborn as sns
3
+
4
+ import maidr
5
+
6
+ # Load the penguins dataset
7
+ penguins = sns.load_dataset("penguins")
8
+
9
+ # Create a bar plot showing the average body mass of penguins by species
10
+ fig, ax = plt.subplots(figsize=(10, 6))
11
+ b_plot = sns.barplot(
12
+ x="species", y="body_mass_g", data=penguins, errorbar="sd", palette="Blues_d", ax=ax
13
+ )
14
+ ax.set_title("Average Body Mass of Penguins by Species")
15
+ ax.set_xlabel("Species")
16
+ ax.set_ylabel("Body Mass (g)")
17
+
18
+ # Add number formatter to y-axis for better screen reader output
19
+ # Body mass values with thousands separator (e.g., "4,500")
20
+ ax.yaxis.set_major_formatter("{x:,.0f}")
21
+
22
+ maidr.show(b_plot)