matplotlib-rs 0.0.8__cp313-cp313-win_amd64.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.
Files changed (352) hide show
  1. docs/releases/0.0.1.md +268 -0
  2. docs/releases/0.0.2.md +69 -0
  3. docs/releases/0.0.3.md +80 -0
  4. docs/releases/0.0.4.md +73 -0
  5. docs/releases/0.0.5.md +24 -0
  6. docs/releases/0.0.6.md +24 -0
  7. docs/releases/0.0.7.md +24 -0
  8. docs/releases/0.0.8.md +16 -0
  9. licenses/LICENSE_CONTOURPY +29 -0
  10. licenses/LICENSE_CYCLER +27 -0
  11. licenses/LICENSE_DATEUTIL +54 -0
  12. licenses/LICENSE_KIWISOLVER +71 -0
  13. licenses/LICENSE_LIBWEBP +56 -0
  14. licenses/LICENSE_MATPLOTLIB +1253 -0
  15. licenses/LICENSE_PYPARSING +20 -0
  16. licenses/LICENSE_QHULL +39 -0
  17. licenses/LICENSE_SIX +18 -0
  18. matplotlib_rs/__init__.py +1683 -0
  19. matplotlib_rs/__main__.py +27 -0
  20. matplotlib_rs/_afm.py +500 -0
  21. matplotlib_rs/_animation_data.py +263 -0
  22. matplotlib_rs/_api/__init__.py +495 -0
  23. matplotlib_rs/_api/deprecation.py +534 -0
  24. matplotlib_rs/_axis_py.py +2991 -0
  25. matplotlib_rs/_blocking_input.py +31 -0
  26. matplotlib_rs/_cm.py +1500 -0
  27. matplotlib_rs/_cm_bivar.py +1289 -0
  28. matplotlib_rs/_cm_listed.py +2848 -0
  29. matplotlib_rs/_cm_multivar.py +167 -0
  30. matplotlib_rs/_color_data.py +1142 -0
  31. matplotlib_rs/_colormap.py +132 -0
  32. matplotlib_rs/_constrained_layout.py +825 -0
  33. matplotlib_rs/_contour.py +108 -0
  34. matplotlib_rs/_doc_cache.py +12214 -0
  35. matplotlib_rs/_docstring.py +142 -0
  36. matplotlib_rs/_enums.py +178 -0
  37. matplotlib_rs/_figure_rs.py +294 -0
  38. matplotlib_rs/_fontconfig_pattern.py +129 -0
  39. matplotlib_rs/_foreign.py +220 -0
  40. matplotlib_rs/_hook.py +94 -0
  41. matplotlib_rs/_image.py +160 -0
  42. matplotlib_rs/_imageio.py +229 -0
  43. matplotlib_rs/_internal_utils.py +65 -0
  44. matplotlib_rs/_kiwi.py +484 -0
  45. matplotlib_rs/_layoutgrid.py +549 -0
  46. matplotlib_rs/_live.py +192 -0
  47. matplotlib_rs/_mathtext.py +3103 -0
  48. matplotlib_rs/_mathtext_data.py +1811 -0
  49. matplotlib_rs/_mplrs.cp313-win_amd64.pyd +0 -0
  50. matplotlib_rs/_path.py +25 -0
  51. matplotlib_rs/_png.py +162 -0
  52. matplotlib_rs/_pylab_helpers.py +137 -0
  53. matplotlib_rs/_qhull.py +66 -0
  54. matplotlib_rs/_rcpush.py +84 -0
  55. matplotlib_rs/_spines_rs.py +108 -0
  56. matplotlib_rs/_style_helpers.py +52 -0
  57. matplotlib_rs/_text_helpers.py +51 -0
  58. matplotlib_rs/_tight_bbox.py +85 -0
  59. matplotlib_rs/_tight_layout.py +302 -0
  60. matplotlib_rs/_tri.py +140 -0
  61. matplotlib_rs/_type1font.py +1228 -0
  62. matplotlib_rs/_vendor/__init__.py +8 -0
  63. matplotlib_rs/_vendor/cycler.py +574 -0
  64. matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
  65. matplotlib_rs/_vendor/dateutil/_common.py +44 -0
  66. matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
  67. matplotlib_rs/_vendor/dateutil/_version.py +5 -0
  68. matplotlib_rs/_vendor/dateutil/easter.py +90 -0
  69. matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
  70. matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
  71. matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
  72. matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
  73. matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
  74. matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
  75. matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
  76. matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
  77. matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
  78. matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
  79. matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
  80. matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
  81. matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
  82. matplotlib_rs/_vendor/dateutil/utils.py +72 -0
  83. matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
  84. matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
  85. matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
  86. matplotlib_rs/_vendor/pyparsing/common.py +571 -0
  87. matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
  88. matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
  89. matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
  90. matplotlib_rs/_vendor/pyparsing/results.py +929 -0
  91. matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
  92. matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
  93. matplotlib_rs/_vendor/pyparsing/util.py +515 -0
  94. matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
  95. matplotlib_rs/_vendor/six.py +1004 -0
  96. matplotlib_rs/animation.py +1843 -0
  97. matplotlib_rs/artist.py +2302 -0
  98. matplotlib_rs/axes/__init__.py +19 -0
  99. matplotlib_rs/axes/_axes.py +9402 -0
  100. matplotlib_rs/axes/_bar.py +185 -0
  101. matplotlib_rs/axes/_base.py +5236 -0
  102. matplotlib_rs/axes/_base_rs.py +727 -0
  103. matplotlib_rs/axes/_boxplot.py +391 -0
  104. matplotlib_rs/axes/_hist.py +99 -0
  105. matplotlib_rs/axes/_secondary_axes.py +357 -0
  106. matplotlib_rs/axis.py +1963 -0
  107. matplotlib_rs/backend_bases.py +3760 -0
  108. matplotlib_rs/backend_managers.py +388 -0
  109. matplotlib_rs/backend_tools.py +1002 -0
  110. matplotlib_rs/backends/__init__.py +6 -0
  111. matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
  112. matplotlib_rs/backends/backend_agg.py +552 -0
  113. matplotlib_rs/backends/backend_mixed.py +123 -0
  114. matplotlib_rs/backends/backend_pdf.py +2711 -0
  115. matplotlib_rs/backends/backend_pgf.py +1031 -0
  116. matplotlib_rs/backends/backend_ps.py +1491 -0
  117. matplotlib_rs/backends/backend_svg.py +1395 -0
  118. matplotlib_rs/backends/backend_template.py +214 -0
  119. matplotlib_rs/backends/registry.py +423 -0
  120. matplotlib_rs/bezier.py +691 -0
  121. matplotlib_rs/category.py +236 -0
  122. matplotlib_rs/cbook.py +2762 -0
  123. matplotlib_rs/cm.py +251 -0
  124. matplotlib_rs/collections.py +2711 -0
  125. matplotlib_rs/colorbar.py +1586 -0
  126. matplotlib_rs/colorizer.py +909 -0
  127. matplotlib_rs/colors.py +4278 -0
  128. matplotlib_rs/container.py +256 -0
  129. matplotlib_rs/contour.py +1756 -0
  130. matplotlib_rs/dates.py +1847 -0
  131. matplotlib_rs/dviread.py +1386 -0
  132. matplotlib_rs/figure.py +3815 -0
  133. matplotlib_rs/font_manager.py +1855 -0
  134. matplotlib_rs/ft2font.py +515 -0
  135. matplotlib_rs/gridspec.py +808 -0
  136. matplotlib_rs/hatch.py +244 -0
  137. matplotlib_rs/image.py +1863 -0
  138. matplotlib_rs/inset.py +291 -0
  139. matplotlib_rs/layout_engine.py +310 -0
  140. matplotlib_rs/legend.py +1480 -0
  141. matplotlib_rs/legend_handler.py +812 -0
  142. matplotlib_rs/lines.py +1886 -0
  143. matplotlib_rs/markers.py +908 -0
  144. matplotlib_rs/mathtext.py +141 -0
  145. matplotlib_rs/mlab.py +959 -0
  146. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
  147. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
  148. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
  149. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
  150. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
  151. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
  152. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
  153. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
  154. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
  155. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
  156. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
  157. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
  158. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
  159. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
  160. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
  161. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
  162. matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
  163. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
  164. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
  165. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
  166. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
  167. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
  168. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
  169. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
  170. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
  171. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
  172. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
  173. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
  174. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
  175. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
  176. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
  177. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
  178. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
  179. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
  180. matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
  181. matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
  182. matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
  183. matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
  184. matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
  185. matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
  186. matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
  187. matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
  188. matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
  189. matplotlib_rs/mpl-data/images/back.pdf +0 -0
  190. matplotlib_rs/mpl-data/images/back.png +0 -0
  191. matplotlib_rs/mpl-data/images/back.svg +46 -0
  192. matplotlib_rs/mpl-data/images/back_large.png +0 -0
  193. matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
  194. matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
  195. matplotlib_rs/mpl-data/images/filesave.png +0 -0
  196. matplotlib_rs/mpl-data/images/filesave.svg +68 -0
  197. matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
  198. matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
  199. matplotlib_rs/mpl-data/images/forward.pdf +0 -0
  200. matplotlib_rs/mpl-data/images/forward.png +0 -0
  201. matplotlib_rs/mpl-data/images/forward.svg +46 -0
  202. matplotlib_rs/mpl-data/images/forward_large.png +0 -0
  203. matplotlib_rs/mpl-data/images/hand.pdf +0 -0
  204. matplotlib_rs/mpl-data/images/hand.png +0 -0
  205. matplotlib_rs/mpl-data/images/hand.svg +130 -0
  206. matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
  207. matplotlib_rs/mpl-data/images/help.pdf +71 -0
  208. matplotlib_rs/mpl-data/images/help.png +0 -0
  209. matplotlib_rs/mpl-data/images/help.svg +52 -0
  210. matplotlib_rs/mpl-data/images/help_large.png +0 -0
  211. matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
  212. matplotlib_rs/mpl-data/images/home.pdf +0 -0
  213. matplotlib_rs/mpl-data/images/home.png +0 -0
  214. matplotlib_rs/mpl-data/images/home.svg +59 -0
  215. matplotlib_rs/mpl-data/images/home_large.png +0 -0
  216. matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
  217. matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
  218. matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
  219. matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
  220. matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
  221. matplotlib_rs/mpl-data/images/move.pdf +0 -0
  222. matplotlib_rs/mpl-data/images/move.png +0 -0
  223. matplotlib_rs/mpl-data/images/move.svg +73 -0
  224. matplotlib_rs/mpl-data/images/move_large.png +0 -0
  225. matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
  226. matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
  227. matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
  228. matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
  229. matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
  230. matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
  231. matplotlib_rs/mpl-data/images/subplots.png +0 -0
  232. matplotlib_rs/mpl-data/images/subplots.svg +81 -0
  233. matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
  234. matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
  235. matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
  236. matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
  237. matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
  238. matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
  239. matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
  240. matplotlib_rs/mpl-data/matplotlibrc +849 -0
  241. matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
  242. matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
  243. matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
  244. matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
  245. matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
  246. matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
  247. matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
  248. matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
  249. matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
  250. matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
  251. matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
  252. matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
  253. matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
  254. matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
  255. matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
  256. matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
  257. matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
  258. matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
  259. matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
  260. matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
  261. matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
  262. matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
  263. matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
  264. matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
  265. matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
  266. matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
  267. matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
  268. matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
  269. matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
  270. matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
  271. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
  272. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
  273. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
  274. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
  275. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
  276. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
  277. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
  278. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
  279. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
  280. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
  281. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
  282. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
  283. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
  284. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
  285. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
  286. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
  287. matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
  288. matplotlib_rs/mpl_toolkits/__init__.py +3 -0
  289. matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
  290. matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
  291. matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
  292. matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
  293. matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
  294. matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
  295. matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
  296. matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
  297. matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
  298. matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
  299. matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
  300. matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
  301. matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
  302. matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
  303. matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
  304. matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
  305. matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
  306. matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
  307. matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
  308. matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
  309. matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
  310. matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
  311. matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
  312. matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
  313. matplotlib_rs/offsetbox.py +1726 -0
  314. matplotlib_rs/patches.py +5049 -0
  315. matplotlib_rs/path.py +1147 -0
  316. matplotlib_rs/patheffects.py +512 -0
  317. matplotlib_rs/projections/__init__.py +126 -0
  318. matplotlib_rs/projections/geo.py +512 -0
  319. matplotlib_rs/projections/polar.py +1518 -0
  320. matplotlib_rs/pylab.py +68 -0
  321. matplotlib_rs/pyplot.py +4834 -0
  322. matplotlib_rs/quiver.py +1236 -0
  323. matplotlib_rs/rcsetup.py +3435 -0
  324. matplotlib_rs/sankey.py +815 -0
  325. matplotlib_rs/scale.py +1002 -0
  326. matplotlib_rs/spines.py +618 -0
  327. matplotlib_rs/stackplot.py +144 -0
  328. matplotlib_rs/streamplot.py +768 -0
  329. matplotlib_rs/style/__init__.py +269 -0
  330. matplotlib_rs/style/core.py +28 -0
  331. matplotlib_rs/table.py +860 -0
  332. matplotlib_rs/texmanager.py +375 -0
  333. matplotlib_rs/text.py +2412 -0
  334. matplotlib_rs/textpath.py +377 -0
  335. matplotlib_rs/ticker.py +3111 -0
  336. matplotlib_rs/transforms.py +3069 -0
  337. matplotlib_rs/tri/__init__.py +24 -0
  338. matplotlib_rs/tri/_triangulation.py +248 -0
  339. matplotlib_rs/tri/_tricontour.py +271 -0
  340. matplotlib_rs/tri/_trifinder.py +97 -0
  341. matplotlib_rs/tri/_triinterpolate.py +1575 -0
  342. matplotlib_rs/tri/_tripcolor.py +170 -0
  343. matplotlib_rs/tri/_triplot.py +87 -0
  344. matplotlib_rs/tri/_trirefine.py +308 -0
  345. matplotlib_rs/tri/_tritools.py +264 -0
  346. matplotlib_rs/typing.py +597 -0
  347. matplotlib_rs/units.py +196 -0
  348. matplotlib_rs/widgets.py +4455 -0
  349. matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
  350. matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
  351. matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
  352. matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
@@ -0,0 +1,512 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Defines classes for path effects. The path effects are supported in `.Text`,
4
+ `.Line2D` and `.Patch`.
5
+
6
+ .. seealso::
7
+ :ref:`patheffects_guide`
8
+ """
9
+
10
+ from matplotlib_rs.backend_bases import RendererBase
11
+ from matplotlib_rs import colors as mcolors
12
+ from matplotlib_rs import patches as mpatches
13
+ from matplotlib_rs import transforms as mtransforms
14
+ from matplotlib_rs.path import Path
15
+ import numpy as np
16
+
17
+
18
+ class AbstractPathEffect:
19
+ """
20
+ A base class for path effects.
21
+
22
+ Subclasses should override the ``draw_path`` method to add effect
23
+ functionality.
24
+ """
25
+
26
+ def __init__(self, offset=(0., 0.)):
27
+ """
28
+ Parameters
29
+ ----------
30
+ offset : (float, float), default: (0, 0)
31
+ The (x, y) offset to apply to the path, measured in points.
32
+ """
33
+ self._offset = offset
34
+
35
+ def _offset_transform(self, renderer):
36
+ """Apply the offset to the given transform."""
37
+ return mtransforms.Affine2D().translate(
38
+ *map(renderer.points_to_pixels, self._offset))
39
+
40
+ def _update_gc(self, gc, new_gc_dict):
41
+ """
42
+ Update the given GraphicsContext with the given dict of properties.
43
+
44
+ The keys in the dictionary are used to identify the appropriate
45
+ ``set_`` method on the *gc*.
46
+ """
47
+ new_gc_dict = new_gc_dict.copy()
48
+
49
+ dashes = new_gc_dict.pop("dashes", None)
50
+ if dashes:
51
+ gc.set_dashes(**dashes)
52
+
53
+ for k, v in new_gc_dict.items():
54
+ set_method = getattr(gc, 'set_' + k, None)
55
+ if not callable(set_method):
56
+ raise AttributeError(f'Unknown property {k}')
57
+ set_method(v)
58
+ return gc
59
+
60
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace=None):
61
+ """
62
+ Derived should override this method. The arguments are the same
63
+ as :meth:`matplotlib.backend_bases.RendererBase.draw_path`
64
+ except the first argument is a renderer.
65
+ """
66
+ # Get the real renderer, not a PathEffectRenderer.
67
+ if isinstance(renderer, PathEffectRenderer):
68
+ renderer = renderer._renderer
69
+ return renderer.draw_path(gc, tpath, affine, rgbFace)
70
+
71
+
72
+ class PathEffectRenderer(RendererBase):
73
+ """
74
+ Implements a Renderer which contains another renderer.
75
+
76
+ This proxy then intercepts draw calls, calling the appropriate
77
+ :class:`AbstractPathEffect` draw method.
78
+
79
+ .. note::
80
+ Not all methods have been overridden on this RendererBase subclass.
81
+ It may be necessary to add further methods to extend the PathEffects
82
+ capabilities further.
83
+ """
84
+
85
+ def __init__(self, path_effects, renderer):
86
+ """
87
+ Parameters
88
+ ----------
89
+ path_effects : iterable of :class:`AbstractPathEffect`
90
+ The path effects which this renderer represents.
91
+ renderer : `~matplotlib.backend_bases.RendererBase` subclass
92
+
93
+ """
94
+ self._path_effects = path_effects
95
+ self._renderer = renderer
96
+
97
+ def copy_with_path_effect(self, path_effects):
98
+ return self.__class__(path_effects, self._renderer)
99
+
100
+ def __getattribute__(self, name):
101
+ if name in ['flipy', 'get_canvas_width_height', 'new_gc',
102
+ 'points_to_pixels', '_text2path', 'height', 'width']:
103
+ return getattr(self._renderer, name)
104
+ else:
105
+ return object.__getattribute__(self, name)
106
+
107
+ def draw_path(self, gc, tpath, affine, rgbFace=None):
108
+ for path_effect in self._path_effects:
109
+ path_effect.draw_path(self._renderer, gc, tpath, affine,
110
+ rgbFace)
111
+
112
+ def draw_markers(
113
+ self, gc, marker_path, marker_trans, path, *args, **kwargs):
114
+ # We do a little shimmy so that all markers are drawn for each path
115
+ # effect in turn. Essentially, we induce recursion (depth 1) which is
116
+ # terminated once we have just a single path effect to work with.
117
+ if len(self._path_effects) == 1:
118
+ # Call the base path effect function - this uses the unoptimised
119
+ # approach of calling "draw_path" multiple times.
120
+ return super().draw_markers(gc, marker_path, marker_trans, path,
121
+ *args, **kwargs)
122
+
123
+ for path_effect in self._path_effects:
124
+ renderer = self.copy_with_path_effect([path_effect])
125
+ # Recursively call this method, only next time we will only have
126
+ # one path effect.
127
+ renderer.draw_markers(gc, marker_path, marker_trans, path,
128
+ *args, **kwargs)
129
+
130
+ def draw_path_collection(self, gc, master_transform, paths, *args,
131
+ **kwargs):
132
+ # We do a little shimmy so that all paths are drawn for each path
133
+ # effect in turn. Essentially, we induce recursion (depth 1) which is
134
+ # terminated once we have just a single path effect to work with.
135
+ if len(self._path_effects) == 1:
136
+ # Call the base path effect function - this uses the unoptimised
137
+ # approach of calling "draw_path" multiple times.
138
+ return super().draw_path_collection(gc, master_transform, paths,
139
+ *args, **kwargs)
140
+
141
+ for path_effect in self._path_effects:
142
+ renderer = self.copy_with_path_effect([path_effect])
143
+ # Recursively call this method, only next time we will only have
144
+ # one path effect.
145
+ renderer.draw_path_collection(gc, master_transform, paths,
146
+ *args, **kwargs)
147
+
148
+ def open_group(self, s, gid=None):
149
+ return self._renderer.open_group(s, gid)
150
+
151
+ def close_group(self, s):
152
+ return self._renderer.close_group(s)
153
+
154
+
155
+ class Normal(AbstractPathEffect):
156
+ """
157
+ The "identity" PathEffect.
158
+
159
+ The Normal PathEffect's sole purpose is to draw the original artist with
160
+ no special path effect.
161
+ """
162
+
163
+
164
+ def _subclass_with_normal(effect_class):
165
+ """
166
+ Create a PathEffect class combining *effect_class* and a normal draw.
167
+ """
168
+
169
+ class withEffect(effect_class):
170
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
171
+ super().draw_path(renderer, gc, tpath, affine, rgbFace)
172
+ renderer.draw_path(gc, tpath, affine, rgbFace)
173
+
174
+ withEffect.__name__ = f"with{effect_class.__name__}"
175
+ withEffect.__qualname__ = f"with{effect_class.__name__}"
176
+ withEffect.__doc__ = f"""
177
+ A shortcut PathEffect for applying `.{effect_class.__name__}` and then
178
+ drawing the original Artist.
179
+
180
+ With this class you can use ::
181
+
182
+ artist.set_path_effects([patheffects.with{effect_class.__name__}()])
183
+
184
+ as a shortcut for ::
185
+
186
+ artist.set_path_effects([patheffects.{effect_class.__name__}(),
187
+ patheffects.Normal()])
188
+ """
189
+ # Docstring inheritance doesn't work for locally-defined subclasses.
190
+ withEffect.draw_path.__doc__ = effect_class.draw_path.__doc__
191
+ return withEffect
192
+
193
+
194
+ class Stroke(AbstractPathEffect):
195
+ """A line based PathEffect which re-draws a stroke."""
196
+
197
+ def __init__(self, offset=(0, 0), **kwargs):
198
+ """
199
+ The path will be stroked with its gc updated with the given
200
+ keyword arguments, i.e., the keyword arguments should be valid
201
+ gc parameter values.
202
+ """
203
+ super().__init__(offset)
204
+ self._gc = kwargs
205
+
206
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
207
+ """Draw the path with updated gc."""
208
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
209
+ gc0.copy_properties(gc)
210
+ gc0 = self._update_gc(gc0, self._gc)
211
+ renderer.draw_path(
212
+ gc0, tpath, affine + self._offset_transform(renderer), rgbFace)
213
+ gc0.restore()
214
+
215
+
216
+ withStroke = _subclass_with_normal(effect_class=Stroke)
217
+
218
+
219
+ class SimplePatchShadow(AbstractPathEffect):
220
+ """A simple shadow via a filled patch."""
221
+
222
+ def __init__(self, offset=(2, -2),
223
+ shadow_rgbFace=None, alpha=None,
224
+ rho=0.3, **kwargs):
225
+ """
226
+ Parameters
227
+ ----------
228
+ offset : (float, float), default: (2, -2)
229
+ The (x, y) offset of the shadow in points.
230
+ shadow_rgbFace : :mpltype:`color`
231
+ The shadow color.
232
+ alpha : float, default: 0.3
233
+ The alpha transparency of the created shadow patch.
234
+ rho : float, default: 0.3
235
+ A scale factor to apply to the rgbFace color if *shadow_rgbFace*
236
+ is not specified.
237
+ **kwargs
238
+ Extra keywords are stored and passed through to
239
+ :meth:`!AbstractPathEffect._update_gc`.
240
+
241
+ """
242
+ super().__init__(offset)
243
+
244
+ if shadow_rgbFace is None:
245
+ self._shadow_rgbFace = shadow_rgbFace
246
+ else:
247
+ self._shadow_rgbFace = mcolors.to_rgba(shadow_rgbFace)
248
+
249
+ if alpha is None:
250
+ alpha = 0.3
251
+
252
+ self._alpha = alpha
253
+ self._rho = rho
254
+
255
+ #: The dictionary of keywords to update the graphics collection with.
256
+ self._gc = kwargs
257
+
258
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
259
+ """
260
+ Overrides the standard draw_path to add the shadow offset and
261
+ necessary color changes for the shadow.
262
+ """
263
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
264
+ gc0.copy_properties(gc)
265
+
266
+ if self._shadow_rgbFace is None:
267
+ r, g, b = (rgbFace or (1., 1., 1.))[:3]
268
+ # Scale the colors by a factor to improve the shadow effect.
269
+ shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
270
+ else:
271
+ shadow_rgbFace = self._shadow_rgbFace
272
+
273
+ gc0.set_foreground(mcolors.to_rgba("none"), isRGBA=True)
274
+ gc0.set_alpha(self._alpha)
275
+ gc0.set_linewidth(0)
276
+
277
+ gc0 = self._update_gc(gc0, self._gc)
278
+ renderer.draw_path(
279
+ gc0, tpath, affine + self._offset_transform(renderer),
280
+ shadow_rgbFace)
281
+ gc0.restore()
282
+
283
+
284
+ withSimplePatchShadow = _subclass_with_normal(effect_class=SimplePatchShadow)
285
+
286
+
287
+ class SimpleLineShadow(AbstractPathEffect):
288
+ """A simple shadow via a line."""
289
+
290
+ def __init__(self, offset=(2, -2),
291
+ shadow_color='k', alpha=0.3, rho=0.3, **kwargs):
292
+ """
293
+ Parameters
294
+ ----------
295
+ offset : (float, float), default: (2, -2)
296
+ The (x, y) offset to apply to the path, in points.
297
+ shadow_color : :mpltype:`color`, default: 'black'
298
+ The shadow color.
299
+ A value of ``None`` takes the original artist's color
300
+ with a scale factor of *rho*.
301
+ alpha : float, default: 0.3
302
+ The alpha transparency of the created shadow patch.
303
+ rho : float, default: 0.3
304
+ A scale factor to apply to the rgbFace color if *shadow_color*
305
+ is ``None``.
306
+ **kwargs
307
+ Extra keywords are stored and passed through to
308
+ :meth:`!AbstractPathEffect._update_gc`.
309
+ """
310
+ super().__init__(offset)
311
+ if shadow_color is None:
312
+ self._shadow_color = shadow_color
313
+ else:
314
+ self._shadow_color = mcolors.to_rgba(shadow_color)
315
+ self._alpha = alpha
316
+ self._rho = rho
317
+ #: The dictionary of keywords to update the graphics collection with.
318
+ self._gc = kwargs
319
+
320
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
321
+ """
322
+ Overrides the standard draw_path to add the shadow offset and
323
+ necessary color changes for the shadow.
324
+ """
325
+ gc0 = renderer.new_gc() # Don't modify gc, but a copy!
326
+ gc0.copy_properties(gc)
327
+
328
+ if self._shadow_color is None:
329
+ r, g, b = (gc0.get_rgb() or (1., 1., 1.))[:3]
330
+ # Scale the colors by a factor to improve the shadow effect.
331
+ shadow_rgbFace = (r * self._rho, g * self._rho, b * self._rho)
332
+ else:
333
+ shadow_rgbFace = self._shadow_color
334
+
335
+ gc0.set_foreground(mcolors.to_rgba(shadow_rgbFace), isRGBA=True)
336
+ gc0.set_alpha(self._alpha)
337
+
338
+ gc0 = self._update_gc(gc0, self._gc)
339
+ renderer.draw_path(
340
+ gc0, tpath, affine + self._offset_transform(renderer))
341
+ gc0.restore()
342
+
343
+
344
+ class PathPatchEffect(AbstractPathEffect):
345
+ """
346
+ Draws a `.PathPatch` instance whose Path comes from the original
347
+ PathEffect artist.
348
+ """
349
+
350
+ def __init__(self, offset=(0, 0), **kwargs):
351
+ """
352
+ Parameters
353
+ ----------
354
+ offset : (float, float), default: (0, 0)
355
+ The (x, y) offset to apply to the path, in points.
356
+ **kwargs
357
+ All keyword arguments are passed through to the
358
+ :class:`~matplotlib.patches.PathPatch` constructor. The
359
+ properties which cannot be overridden are "path", "clip_box"
360
+ "transform" and "clip_path".
361
+ """
362
+ super().__init__(offset=offset)
363
+ self.patch = mpatches.PathPatch([], **kwargs)
364
+
365
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
366
+ self.patch._path = tpath
367
+ self.patch.set_transform(affine + self._offset_transform(renderer))
368
+ self.patch.set_clip_box(gc.get_clip_rectangle())
369
+ clip_path = gc.get_clip_path()
370
+ if clip_path and self.patch.get_clip_path() is None:
371
+ self.patch.set_clip_path(*clip_path)
372
+ self.patch.draw(renderer)
373
+
374
+
375
+ class TickedStroke(AbstractPathEffect):
376
+ """
377
+ A line-based PathEffect which draws a path with a ticked style.
378
+
379
+ This line style is frequently used to represent constraints in
380
+ optimization. The ticks may be used to indicate that one side
381
+ of the line is invalid or to represent a closed boundary of a
382
+ domain (i.e. a wall or the edge of a pipe).
383
+
384
+ The spacing, length, and angle of ticks can be controlled.
385
+
386
+ This line style is sometimes referred to as a hatched line.
387
+
388
+ See also the :doc:`/gallery/misc/tickedstroke_demo` example.
389
+ """
390
+
391
+ def __init__(self, offset=(0, 0),
392
+ spacing=10.0, angle=45.0, length=np.sqrt(2),
393
+ **kwargs):
394
+ """
395
+ Parameters
396
+ ----------
397
+ offset : (float, float), default: (0, 0)
398
+ The (x, y) offset to apply to the path, in points.
399
+ spacing : float, default: 10.0
400
+ The spacing between ticks in points.
401
+ angle : float, default: 45.0
402
+ The angle between the path and the tick in degrees. The angle
403
+ is measured as if you were an ant walking along the curve, with
404
+ zero degrees pointing directly ahead, 90 to your left, -90
405
+ to your right, and 180 behind you. To change side of the ticks,
406
+ change sign of the angle.
407
+ length : float, default: 1.414
408
+ The length of the tick relative to spacing.
409
+ Recommended length = 1.414 (sqrt(2)) when angle=45, length=1.0
410
+ when angle=90 and length=2.0 when angle=60.
411
+ **kwargs
412
+ Extra keywords are stored and passed through to
413
+ :meth:`!AbstractPathEffect._update_gc`.
414
+
415
+ Examples
416
+ --------
417
+ See :doc:`/gallery/misc/tickedstroke_demo`.
418
+ """
419
+ super().__init__(offset)
420
+
421
+ self._spacing = spacing
422
+ self._angle = angle
423
+ self._length = length
424
+ self._gc = kwargs
425
+
426
+ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
427
+ """Draw the path with updated gc."""
428
+ # Do not modify the input! Use copy instead.
429
+ gc0 = renderer.new_gc()
430
+ gc0.copy_properties(gc)
431
+
432
+ gc0 = self._update_gc(gc0, self._gc)
433
+ trans = affine + self._offset_transform(renderer)
434
+
435
+ theta = -np.radians(self._angle)
436
+ trans_matrix = np.array([[np.cos(theta), -np.sin(theta)],
437
+ [np.sin(theta), np.cos(theta)]])
438
+
439
+ # Convert spacing parameter to pixels.
440
+ spacing_px = renderer.points_to_pixels(self._spacing)
441
+
442
+ # Transform before evaluation because to_polygons works at resolution
443
+ # of one -- assuming it is working in pixel space.
444
+ transpath = affine.transform_path(tpath)
445
+
446
+ # Evaluate path to straight line segments that can be used to
447
+ # construct line ticks.
448
+ polys = transpath.to_polygons(closed_only=False)
449
+
450
+ for p in polys:
451
+ x = p[:, 0]
452
+ y = p[:, 1]
453
+
454
+ # Can not interpolate points or draw line if only one point in
455
+ # polyline.
456
+ if x.size < 2:
457
+ continue
458
+
459
+ # Find distance between points on the line
460
+ ds = np.hypot(x[1:] - x[:-1], y[1:] - y[:-1])
461
+
462
+ # Build parametric coordinate along curve
463
+ s = np.concatenate(([0.0], np.cumsum(ds)))
464
+ s_total = s[-1]
465
+
466
+ num = int(np.ceil(s_total / spacing_px)) - 1
467
+ # Pick parameter values for ticks.
468
+ s_tick = np.linspace(spacing_px/2, s_total - spacing_px/2, num)
469
+
470
+ # Find points along the parameterized curve
471
+ x_tick = np.interp(s_tick, s, x)
472
+ y_tick = np.interp(s_tick, s, y)
473
+
474
+ # Find unit vectors in local direction of curve
475
+ delta_s = self._spacing * .001
476
+ u = (np.interp(s_tick + delta_s, s, x) - x_tick) / delta_s
477
+ v = (np.interp(s_tick + delta_s, s, y) - y_tick) / delta_s
478
+
479
+ # Normalize slope into unit slope vector.
480
+ n = np.hypot(u, v)
481
+ mask = n == 0
482
+ n[mask] = 1.0
483
+
484
+ uv = np.array([u / n, v / n]).T
485
+ uv[mask] = np.array([0, 0]).T
486
+
487
+ # Rotate and scale unit vector into tick vector
488
+ dxy = np.dot(uv, trans_matrix) * self._length * spacing_px
489
+
490
+ # Build tick endpoints
491
+ x_end = x_tick + dxy[:, 0]
492
+ y_end = y_tick + dxy[:, 1]
493
+
494
+ # Interleave ticks to form Path vertices
495
+ xyt = np.empty((2 * num, 2), dtype=x_tick.dtype)
496
+ xyt[0::2, 0] = x_tick
497
+ xyt[1::2, 0] = x_end
498
+ xyt[0::2, 1] = y_tick
499
+ xyt[1::2, 1] = y_end
500
+
501
+ # Build up vector of Path codes
502
+ codes = np.tile([Path.MOVETO, Path.LINETO], num)
503
+
504
+ # Construct and draw resulting path
505
+ h = Path(xyt, codes)
506
+ # Transform back to data space during render
507
+ renderer.draw_path(gc0, h, affine.inverted() + trans, rgbFace)
508
+
509
+ gc0.restore()
510
+
511
+
512
+ withTickedStroke = _subclass_with_normal(effect_class=TickedStroke)
@@ -0,0 +1,126 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Non-separable transforms that map from data space to screen space.
4
+
5
+ Projections are defined as `~.axes.Axes` subclasses. They include the
6
+ following elements:
7
+
8
+ - A transformation from data coordinates into display coordinates.
9
+
10
+ - An inverse of that transformation. This is used, for example, to convert
11
+ mouse positions from screen space back into data space.
12
+
13
+ - Transformations for the gridlines, ticks and ticklabels. Custom projections
14
+ will often need to place these elements in special locations, and Matplotlib
15
+ has a facility to help with doing so.
16
+
17
+ - Setting up default values (overriding `~.axes.Axes.cla`), since the defaults
18
+ for a rectilinear Axes may not be appropriate.
19
+
20
+ - Defining the shape of the Axes, for example, an elliptical Axes, that will be
21
+ used to draw the background of the plot and for clipping any data elements.
22
+
23
+ - Defining custom locators and formatters for the projection. For example, in
24
+ a geographic projection, it may be more convenient to display the grid in
25
+ degrees, even if the data is in radians.
26
+
27
+ - Set up interactive panning and zooming. This is left as an "advanced"
28
+ feature left to the reader, but there is an example of this for polar plots
29
+ in `matplotlib.projections.polar`.
30
+
31
+ - Any additional methods for additional convenience or features.
32
+
33
+ Once the projection Axes is defined, it can be used in one of two ways:
34
+
35
+ - By defining the class attribute ``name``, the projection Axes can be
36
+ registered with `matplotlib.projections.register_projection` and subsequently
37
+ simply invoked by name::
38
+
39
+ fig.add_subplot(projection="my_proj_name")
40
+
41
+ - For more complex, parameterisable projections, a generic "projection" object
42
+ may be defined which includes the method ``_as_mpl_axes``. ``_as_mpl_axes``
43
+ should take no arguments and return the projection's Axes subclass and a
44
+ dictionary of additional arguments to pass to the subclass' ``__init__``
45
+ method. Subsequently a parameterised projection can be initialised with::
46
+
47
+ fig.add_subplot(projection=MyProjection(param1=param1_value))
48
+
49
+ where MyProjection is an object which implements a ``_as_mpl_axes`` method.
50
+
51
+ A full-fledged and heavily annotated example is in
52
+ :doc:`/gallery/misc/custom_projection`. The polar plot functionality in
53
+ `matplotlib.projections.polar` may also be of interest.
54
+ """
55
+
56
+ from .. import _api, axes, _docstring
57
+ import importlib
58
+
59
+ # projection name -> (module, class), imported on first use
60
+ _LAZY_PROJECTIONS = {
61
+ "aitoff": ("matplotlib_rs.projections.geo", "AitoffAxes"),
62
+ "hammer": ("matplotlib_rs.projections.geo", "HammerAxes"),
63
+ "lambert": ("matplotlib_rs.projections.geo", "LambertAxes"),
64
+ "mollweide": ("matplotlib_rs.projections.geo", "MollweideAxes"),
65
+ "polar": ("matplotlib_rs.projections.polar", "PolarAxes"),
66
+ "3d": ("matplotlib_rs.mpl_toolkits.mplot3d", "Axes3D"),
67
+ }
68
+ _LAZY_NAMES = {cls: (mod, cls) for mod, cls in _LAZY_PROJECTIONS.values()}
69
+
70
+
71
+ def __getattr__(name):
72
+ if name in _LAZY_NAMES:
73
+ mod, cls = _LAZY_NAMES[name]
74
+ value = getattr(importlib.import_module(mod), cls)
75
+ globals()[name] = value
76
+ return value
77
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
78
+
79
+
80
+ class ProjectionRegistry:
81
+ """A mapping of registered projection names to projection classes."""
82
+
83
+ def __init__(self):
84
+ self._all_projection_types = {}
85
+
86
+ def register(self, *projections):
87
+ """Register a new set of projections."""
88
+ for projection in projections:
89
+ name = projection.name
90
+ self._all_projection_types[name] = projection
91
+
92
+ def get_projection_class(self, name, _error_cls=KeyError):
93
+ """Get a projection class from its *name*."""
94
+ if name not in self._all_projection_types and name in _LAZY_PROJECTIONS:
95
+ mod, cls = _LAZY_PROJECTIONS[name]
96
+ self.register(getattr(importlib.import_module(mod), cls))
97
+ return _api.getitem_checked(self._all_projection_types, _error_cls=_error_cls,
98
+ projection=name)
99
+
100
+ def get_projection_names(self):
101
+ """Return the names of all projections currently registered."""
102
+ return sorted({*self._all_projection_types, *_LAZY_PROJECTIONS})
103
+
104
+
105
+ projection_registry = ProjectionRegistry()
106
+ projection_registry.register(axes.Axes)
107
+
108
+
109
+ def register_projection(cls):
110
+ projection_registry.register(cls)
111
+
112
+
113
+ def get_projection_class(projection=None):
114
+ """
115
+ Get a projection class from its name.
116
+
117
+ If *projection* is None, a standard rectilinear projection is returned.
118
+ """
119
+ if projection is None:
120
+ projection = 'rectilinear'
121
+
122
+ return projection_registry.get_projection_class(projection, _error_cls=ValueError)
123
+
124
+
125
+ get_projection_names = projection_registry.get_projection_names
126
+ _docstring.interpd.register(projection_names=get_projection_names())