matplotlib-rs 0.0.8__cp315-cp315-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.cp315-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,727 @@
1
+ """
2
+ The Rust side of `matplotlib.axes._base._AxesBase`.
3
+
4
+ The Python Axes keeps all of matplotlib's state and logic (limits,
5
+ autoscaling, aspect, units, ...). Each Axes owns an Axes of the Rust model
6
+ that mirrors the state needed for drawing (position, view and data limits)
7
+ and draws the axes with its spines, ticks, titles and children. Children
8
+ the Rust core can draw itself (lines, patches, texts) are handed over as
9
+ Rust handles; any other artist is drawn by its own ``draw`` method.
10
+ """
11
+
12
+ import functools
13
+ import weakref
14
+
15
+ from .. import _mplrs
16
+ from .. import artist as martist
17
+ from .. import cbook
18
+ from .. import lines as mlines
19
+ from .. import patches as mpatches
20
+ from .. import text as mtext
21
+ from .. import transforms as mtransforms
22
+
23
+
24
+ class _FlushBbox(mtransforms.Bbox):
25
+ """A Bbox whose changes are mirrored to the Rust model at the next sync."""
26
+
27
+ def __init__(self, points, owner, **kwargs):
28
+ super().__init__(points, **kwargs)
29
+ self._rs_owner_ref = weakref.ref(owner)
30
+
31
+ def invalidate(self):
32
+ owner = self._rs_owner_ref()
33
+ if owner is not None:
34
+ martist._DIRTY.add(owner)
35
+ return super().invalidate()
36
+
37
+
38
+ _FlushBbox.__name__ = "Bbox" # (as printed by transforms)
39
+
40
+
41
+ # methods whose overrides decide an artist's geometry, and the modules whose
42
+ # artists keep it up to date by marking themselves stale
43
+ _GEOMETRY_METHODS = ("get_path", "get_patch_transform", "get_xydata", "recache",
44
+ "_get_transformed_path", "get_text", "get_window_extent")
45
+ _CORE_MODULES = {"matplotlib_rs.lines", "matplotlib_rs.patches", "matplotlib_rs.text",
46
+ "matplotlib_rs.artist"}
47
+
48
+
49
+ def _rs_native(a):
50
+ """Whether the Rust core draws *a* itself (instead of ``a.draw``)."""
51
+ h = a.__dict__.get("_h")
52
+ if not isinstance(h, (_mplrs.Line2D, _mplrs.Text, _mplrs.Patch)):
53
+ return False
54
+ cls = type(a)
55
+ if isinstance(a, mlines.Line2D):
56
+ base = mlines.Line2D
57
+ elif isinstance(a, mtext.Text):
58
+ base = mtext.Text
59
+ if a.get_usetex() or a._bbox_patch is not None:
60
+ return False
61
+ elif isinstance(a, mpatches.Patch):
62
+ base = mpatches.Patch
63
+ else:
64
+ return False
65
+ # subclasses computing their transform at draw time (e.g. axline's)
66
+ if cls.draw is not base.draw or cls.get_transform is not base.get_transform:
67
+ return False
68
+ # subclasses from elsewhere may compute their geometry when drawn (e.g.
69
+ # the connectors of mpl_toolkits' mark_inset)
70
+ for name in _GEOMETRY_METHODS:
71
+ m = getattr(cls, name, None)
72
+ if m is not None and getattr(m, "__module__", None) not in _CORE_MODULES:
73
+ return False
74
+ if a.get_path_effects() or a.get_agg_filter() is not None or a.get_rasterized():
75
+ return False
76
+ try:
77
+ martist._rs_clip_path(a)
78
+ except NotImplementedError:
79
+ return False
80
+ return True
81
+
82
+
83
+ def _rs_attach(ax, a):
84
+ """Add child *a* (just appended to ``ax._children``) to the Rust axes."""
85
+ native = _rs_native(a)
86
+ a._rs_native_in = native
87
+ a._rs_switch = functools.partial(_rs_switch_child, weakref.ref(ax))
88
+ if native:
89
+ martist._DIRTY.discard(a)
90
+ a._rs_sync()
91
+ ax._rs.add_child_raw(a._h)
92
+ else:
93
+ ax._rs.add_child_raw(a)
94
+
95
+
96
+ def _rs_detach(ax, a):
97
+ """Remove child *a* (just removed from ``ax._children``) from the Rust axes."""
98
+ rs = ax.__dict__.get("_rs") if ax is not None else None
99
+ if rs is not None:
100
+ rs.remove_child(a._h if a.__dict__.get("_rs_native_in") else a)
101
+
102
+
103
+ class _Pending:
104
+ """
105
+ The artists of a plotting call (the components of a boxplot), created
106
+ when they are first needed.
107
+
108
+ The Rust axes has them as one child, an `_mplrs.ArtistBatch`, which draws
109
+ them from arrays. ``Axes._children`` has this object in their place until
110
+ the list is read (`_RsChildren._expand`); the lists a plotting method
111
+ returns (`_PendingList`) create the artists of their component only.
112
+
113
+ An artist created here is an ordinary, independent artist with its own
114
+ Rust handle. While none of them is changed, the batch goes on drawing
115
+ all the artists. The first change (an artist marked stale, hence synced,
116
+ or removed) replaces the batch by the handles of all its artists
117
+ (`explode`), which are drawn one by one from then on.
118
+
119
+ Artist *i* of slot *s* is child ``base + i * len(slots) + s`` of the Axes.
120
+ A slot is a dict with the keys
121
+
122
+ - ``prototype``: an artist with the class and the properties of the
123
+ artists of the slot;
124
+ - ``make``: ``make(handles, switch, dead)`` returns the *n* artists for
125
+ their Rust handles; they call ``switch(artist)`` when they are synced
126
+ (``_rs_switch``); *dead* tells that the Axes was cleared;
127
+ - ``points``: the (N, 2) data of lines, for the data limits (None: the
128
+ slot has no part in them).
129
+ """
130
+
131
+ def __init__(self, axes, batch, n, slots):
132
+ self.axes = axes
133
+ self._axref = weakref.ref(axes)
134
+ self.batch = batch
135
+ self.n = n
136
+ self.slots = slots
137
+ self.made = [None] * len(slots)
138
+ self.exploded = False
139
+ self.dead = False
140
+ #: (axis name, lower edges, upper edges, slot): the sticky edges
141
+ #: of the artists of a slot (see `set_sticky`)
142
+ self.sticky = None
143
+ #: (slot, labels): the labels of the first artists of a slot (see
144
+ #: `set_labels`)
145
+ self.labels = None
146
+
147
+ def __len__(self):
148
+ return self.n * len(self.slots)
149
+
150
+ def explode(self):
151
+ """Hand the Rust axes the handles of the artists instead of the batch."""
152
+ if self.exploded:
153
+ return
154
+ self.exploded = True
155
+ children = self.axes._children
156
+ if isinstance(children, _RsChildren) and self in children._packed:
157
+ children._packed.remove(self)
158
+ if not self.dead:
159
+ try:
160
+ self.axes._rs.explode_batch(self.batch)
161
+ except ValueError: # (the Rust axes is gone)
162
+ pass
163
+
164
+ def _switch(self, a):
165
+ # An artist is about to be synced: it changed.
166
+ if not self.exploded:
167
+ self.explode()
168
+ _rs_switch_child(self._axref, a)
169
+
170
+ @cbook._gc_paused # (many artists: see cbook._gc_paused)
171
+ def slot_artists(self, s):
172
+ """The artists of slot *s* (created if needed)."""
173
+ made = self.made[s]
174
+ if made is None:
175
+ made = self.made[s] = self.slots[s]["make"](
176
+ self.batch.handles(s), self._switch, self.dead)
177
+ sticky = self.sticky
178
+ if sticky is not None and sticky[3] == s:
179
+ name, lower, upper, _ = sticky
180
+ self.sticky = None
181
+ pair = martist._XYPair
182
+ if name == "x":
183
+ for a, lo, hi in zip(made, lower, upper):
184
+ a._sticky_edges = pair([lo, hi], [])
185
+ else:
186
+ for a, lo, hi in zip(made, lower, upper):
187
+ a._sticky_edges = pair([], [lo, hi])
188
+ labels = self.labels
189
+ if labels is not None and labels[0] == s:
190
+ self.labels = None
191
+ for a, label in zip(made, labels[1]): # (as Artist.set_label)
192
+ a._label = label
193
+ a._h.set("label", "" if label is None else label)
194
+ return made
195
+
196
+ @cbook._gc_paused
197
+ def artists(self):
198
+ """All the artists, in the order of the children."""
199
+ nslots = len(self.slots)
200
+ out = [None] * len(self)
201
+ for s in range(nslots):
202
+ out[s::nslots] = self.slot_artists(s)
203
+ return out
204
+
205
+ def existing(self):
206
+ """The artists created so far, in the order of the children."""
207
+ made = [m for m in self.made if m is not None]
208
+ if not made:
209
+ return ()
210
+ if len(made) == 1:
211
+ return made[0]
212
+ return [a for group in zip(*made) for a in group]
213
+
214
+ def set_sticky(self, s, name, lower, upper):
215
+ """Give artist *i* of slot *s* the sticky edges ``[lower[i], upper[i]]``
216
+ on the *name* axis (and no others)."""
217
+ if self.made[s] is None and self.sticky is None:
218
+ self.sticky = (name, lower, upper, s)
219
+ return
220
+ for a, lo, hi in zip(self.slot_artists(s), lower, upper):
221
+ getattr(a.sticky_edges, name).extend([lo, hi])
222
+
223
+ def set_labels(self, s, labels):
224
+ """``artist.set_label(label)`` for the first artists of slot *s*."""
225
+ if self.made[s] is None and self.labels is None:
226
+ self.labels = (s, [None if label is None else str(label) for label in labels])
227
+ return
228
+ for a, label in zip(self.slot_artists(s), labels):
229
+ a.set_label(label)
230
+
231
+ def pending_sticky(self, name):
232
+ """The sticky edges on the *name* axis of the artists not created."""
233
+ sticky = self.sticky
234
+ if sticky is not None and sticky[0] == name:
235
+ return [*sticky[1], *sticky[2]]
236
+ return ()
237
+
238
+ def limit_points(self, visible_only):
239
+ """The points that count for the data limits when no artist has been
240
+ created (and so none changed), or None: the artists tell."""
241
+ if any(m is not None for m in self.made):
242
+ return None
243
+ out = []
244
+ for slot in self.slots:
245
+ points = slot["points"]
246
+ if points is not None and (not visible_only or slot["prototype"].get_visible()):
247
+ if not slot["finite"]:
248
+ return None
249
+ out.append(points)
250
+ return out
251
+
252
+ def make_labelled(self):
253
+ """Create the artists that a legend may show (those of the slots
254
+ whose label does not start with an underscore, or with labels of
255
+ their own)."""
256
+ for s, slot in enumerate(self.slots):
257
+ label = slot["prototype"].get_label()
258
+ if self.made[s] is None and (
259
+ label and not label.startswith("_")
260
+ or self.labels is not None and self.labels[0] == s):
261
+ self.slot_artists(s)
262
+
263
+ def count(self, check):
264
+ """The number of artists that satisfy *check* (a test of their type)."""
265
+ return self.n * sum(bool(check(slot["prototype"])) for slot in self.slots)
266
+
267
+
268
+ @cbook._fills_when_read
269
+ class _PendingList(list):
270
+ """
271
+ A list of artists a plotting method returns (``boxplot(...)["boxes"]``)
272
+ that are created when the list is first read: the artists of the slots
273
+ *slots* of *pending*, taken in turn (slot 0 of box 0, slot 1 of box 0, ...).
274
+ """
275
+
276
+ __slots__ = ("_pending", "_pending_slots")
277
+
278
+ def __init__(self, pending, slots):
279
+ super().__init__()
280
+ self._pending = pending
281
+ self._pending_slots = slots
282
+
283
+ def _fill(self):
284
+ pending = self._pending
285
+ if pending is not None:
286
+ self._pending = None
287
+ parts = [pending.slot_artists(s) for s in self._pending_slots]
288
+ if len(parts) == 1:
289
+ list.extend(self, parts[0])
290
+ else:
291
+ list.extend(self, [a for group in zip(*parts) for a in group])
292
+
293
+ def _set_labels(self, labels):
294
+ """`_Pending.set_labels` for the artists of this (one-slot) list;
295
+ False if the artists were already created."""
296
+ if self._pending is None or len(self._pending_slots) != 1:
297
+ return False
298
+ self._pending.set_labels(self._pending_slots[0], labels)
299
+ return True
300
+
301
+ def _set_sticky(self, name, lower, upper):
302
+ """`_Pending.set_sticky` for the artists of this (one-slot) list;
303
+ False if the artists were already created."""
304
+ if self._pending is None or len(self._pending_slots) != 1:
305
+ return False
306
+ self._pending.set_sticky(self._pending_slots[0], name, lower, upper)
307
+ return True
308
+
309
+ def __len__(self):
310
+ pending = self._pending
311
+ if pending is not None:
312
+ return pending.n * len(self._pending_slots)
313
+ return list.__len__(self)
314
+
315
+ def __reduce_ex__(self, protocol):
316
+ self._fill()
317
+ return (list, (list(self),))
318
+
319
+
320
+ class _RsChildren(list):
321
+ """``Axes._children``, keeping the children of the Rust axes in step.
322
+
323
+ matplotlib adds children by appending to this list (and removes them
324
+ through ``_remove_method = _children.remove``). ``clear`` does not
325
+ notify: matplotlib only clears a list it has already swapped out, after
326
+ the Rust axes has been cleared.
327
+
328
+ The list may hold `_Pending` objects in place of artists not created yet
329
+ (``_extra`` counts the artists they stand for, less the objects
330
+ themselves). Reading the list creates the artists; ``len``, ``append``
331
+ and the methods below do not. ``_packed`` are the `_Pending` whose
332
+ artists the Rust axes draws as one batch.
333
+ """
334
+
335
+ __slots__ = ("_axref", "_extra", "_holders", "_packed")
336
+
337
+ def __init__(self, ax, items=()):
338
+ super().__init__()
339
+ self._axref = weakref.ref(ax)
340
+ self._extra = 0
341
+ self._holders = 0
342
+ self._packed = []
343
+ self.extend(items)
344
+
345
+ # -- artists created when they are needed --------------------------------
346
+
347
+ def _add_pending(self, pending):
348
+ """Add the artists of *pending* (a `_Pending`), after the children."""
349
+ list.append(self, pending)
350
+ self._extra += len(pending) - 1
351
+ self._holders += 1
352
+ self._packed.append(pending)
353
+ self._axref()._rs.add_child_raw(pending.batch)
354
+
355
+ def _expand(self):
356
+ """Create the artists that are not, in their places."""
357
+ if self._holders:
358
+ items = []
359
+ for a in list.__iter__(self):
360
+ if type(a) is _Pending:
361
+ items.extend(a.artists())
362
+ else:
363
+ items.append(a)
364
+ list.__setitem__(self, slice(None), items)
365
+ self._extra = self._holders = 0
366
+
367
+ def _unpack(self):
368
+ """Create the artists and give their handles to the Rust axes: a
369
+ child is about to be removed or moved."""
370
+ self._expand()
371
+ for pending in list(self._packed):
372
+ pending.explode()
373
+
374
+ def _detach_pending(self):
375
+ """The Axes is being cleared: artists created later have no Axes."""
376
+ for pending in self._packed:
377
+ pending.exploded = True
378
+ self._packed = []
379
+ if self._holders:
380
+ items = []
381
+ for a in list.__iter__(self):
382
+ if type(a) is _Pending:
383
+ a.dead = a.exploded = True
384
+ items.extend(a.existing())
385
+ else:
386
+ items.append(a)
387
+ list.__setitem__(self, slice(None), items)
388
+ self._extra = self._holders = 0
389
+
390
+ def _existing(self):
391
+ """The children that exist as Python objects, in order."""
392
+ if not self._holders:
393
+ return list.__iter__(self)
394
+ items = []
395
+ for a in list.__iter__(self):
396
+ if type(a) is _Pending:
397
+ items.extend(a.existing())
398
+ else:
399
+ items.append(a)
400
+ return items
401
+
402
+ def _pending(self):
403
+ """The `_Pending` whose artists are not all in the list."""
404
+ if not self._holders:
405
+ return ()
406
+ return [a for a in list.__iter__(self) if type(a) is _Pending]
407
+
408
+ def _count(self, check):
409
+ """``sum(check(a) for a in self)`` for a *check* of the artist types."""
410
+ return sum(a.count(check) if type(a) is _Pending else bool(check(a))
411
+ for a in list.__iter__(self))
412
+
413
+ def __len__(self):
414
+ return list.__len__(self) + self._extra
415
+
416
+ def __reduce_ex__(self, protocol):
417
+ self._expand()
418
+ return super().__reduce_ex__(protocol)
419
+
420
+ # -- the list ------------------------------------------------------------
421
+
422
+ def append(self, a):
423
+ super().append(a)
424
+ ax = self._axref()
425
+ if ax is not None:
426
+ _rs_attach(ax, a)
427
+
428
+ def extend(self, items):
429
+ for a in items:
430
+ self.append(a)
431
+
432
+ def insert(self, i, a):
433
+ self._unpack()
434
+ super().insert(i, a)
435
+ ax = self._axref()
436
+ if ax is not None:
437
+ _rs_attach(ax, a)
438
+
439
+ def remove(self, a):
440
+ self._unpack()
441
+ super().remove(a)
442
+ _rs_detach(self._axref(), a)
443
+
444
+ def pop(self, i=-1):
445
+ self._unpack()
446
+ a = super().pop(i)
447
+ _rs_detach(self._axref(), a)
448
+ return a
449
+
450
+ def __delitem__(self, i):
451
+ self._unpack()
452
+ items = list.__getitem__(self, i) if isinstance(i, slice) else [list.__getitem__(self, i)]
453
+ super().__delitem__(i)
454
+ for a in items:
455
+ _rs_detach(self._axref(), a)
456
+
457
+ def clear(self):
458
+ # (of a list that is not an Axes' any more: see the class docstring)
459
+ super().clear()
460
+ self._extra = self._holders = 0
461
+ self._packed = []
462
+
463
+
464
+ def _expanded(name, unpack=False):
465
+ method = getattr(list, name)
466
+
467
+ @functools.wraps(method)
468
+ def wrapper(self, *args, **kwargs):
469
+ if unpack:
470
+ self._unpack()
471
+ else:
472
+ self._expand()
473
+ return method(self, *args, **kwargs)
474
+
475
+ return wrapper
476
+
477
+
478
+ for _name in ("__iter__", "__getitem__", "__contains__", "__reversed__", "__eq__", "__ne__",
479
+ "__lt__", "__le__", "__gt__", "__ge__", "__add__", "__mul__", "__rmul__",
480
+ "__repr__", "__sizeof__", "index", "count", "copy"):
481
+ setattr(_RsChildren, _name, _expanded(_name))
482
+ for _name in ("__setitem__", "__iadd__", "__imul__", "sort", "reverse"):
483
+ setattr(_RsChildren, _name, _expanded(_name, unpack=True))
484
+ del _name
485
+
486
+
487
+ def _radd(self, other):
488
+ # (``[...] + children``, which list would do by reading the items directly)
489
+ self._expand()
490
+ return other + list.copy(self) if isinstance(other, list) else NotImplemented
491
+
492
+
493
+ _RsChildren.__radd__ = _radd
494
+
495
+
496
+ def _existing_children(ax):
497
+ """The children of *ax* that exist as Python objects: artists not yet
498
+ created (see `_Pending`) are left out."""
499
+ children = ax._children
500
+ return children._existing() if isinstance(children, _RsChildren) else children
501
+
502
+
503
+ def _pending_children(ax):
504
+ """The `_Pending` of *ax* whose artists are not all created."""
505
+ children = ax._children
506
+ return children._pending() if isinstance(children, _RsChildren) else ()
507
+
508
+
509
+ def _rs_switch_child(axref, a):
510
+ """Swap a child between native and Python drawing (keeping its place)."""
511
+ ax = axref()
512
+ native = _rs_native(a)
513
+ if ax is None or native == a.__dict__.get("_rs_native_in"):
514
+ return
515
+ old = a._h if a._rs_native_in else a
516
+ new = a._h if native else a
517
+ if ax._rs.replace_child(old, new):
518
+ a._rs_native_in = native
519
+
520
+
521
+ def _rs_attr(name):
522
+ """An attribute mirrored into the Rust axes (by ``_rs_sync``)."""
523
+ key = "_rs_attr_" + name
524
+
525
+ def getter(self):
526
+ return self.__dict__.get(key)
527
+
528
+ def setter(self, v):
529
+ self.__dict__[key] = v
530
+ martist._DIRTY.add(self)
531
+
532
+ return property(getter, setter)
533
+
534
+
535
+ def _rs_py_drawn(ax):
536
+ """Whether *ax* is drawn by matplotlib's Python code rather than by the
537
+ Rust core: non-rectilinear projections (polar, geo, 3d) and axes with
538
+ their own children (mpl_toolkits.axisartist)."""
539
+ from ._base import _AxesBase
540
+ return ax.name != "rectilinear" or type(ax).get_children is not _AxesBase.get_children
541
+
542
+
543
+ def _patch_axes_base(cls):
544
+ orig_draw = cls.draw
545
+ orig_set_figure = cls.set_figure
546
+ orig_init_axis = cls._init_axis
547
+
548
+ def _init_axis(self):
549
+ if not _rs_py_drawn(self):
550
+ return orig_init_axis(self)
551
+ # axes drawn by Python use matplotlib's own Axis (see _axis_py.py)
552
+ from .. import _axis_py
553
+ self.xaxis = _axis_py.XAxis(self, clear=False)
554
+ self.spines.bottom.register_axis(self.xaxis)
555
+ self.spines.top.register_axis(self.xaxis)
556
+ self.yaxis = _axis_py.YAxis(self, clear=False)
557
+ self.spines.left.register_axis(self.yaxis)
558
+ self.spines.right.register_axis(self.yaxis)
559
+
560
+ _init_axis.__doc__ = orig_init_axis.__doc__
561
+ cls._init_axis = _init_axis
562
+ orig_set_lim_and_transforms = cls._set_lim_and_transforms
563
+ orig_clear = cls._AxesBase__clear
564
+ orig_gen_axes_patch = cls._gen_axes_patch
565
+
566
+ def set_figure(self, fig):
567
+ martist.Artist.set_figure(self, fig)
568
+ if self.__dict__.get("_rs") is None:
569
+ root = fig.get_figure(root=True)
570
+ uid = root._rs.new_axes(tuple(map(float, self._position.bounds)))
571
+ self._rs = root._rs.axes(uid)
572
+ if _rs_py_drawn(self):
573
+ self._rs.set_ext_draw(self)
574
+ self._position = _FlushBbox(self._position.get_points(), self)
575
+ if fig.transSubfigure is not fig.get_figure(root=True).transFigure:
576
+ from .._live import PyTransformRef
577
+ self._rs.set_trans_subfigure(("py", PyTransformRef(fig.transSubfigure)))
578
+ self.bbox = mtransforms.TransformedBbox(self._position, fig.transSubfigure)
579
+ self.bbox._rs_clip_spec = "axes"
580
+ self.bbox._rs_bbox_spec = "axes"
581
+ # these will be updated later as data is added
582
+ self.dataLim = _FlushBbox(mtransforms.Bbox.null().get_points(), self)
583
+ self._viewLim = _FlushBbox(mtransforms.Bbox.unit().get_points(), self)
584
+ self.transScale = mtransforms.TransformWrapper(
585
+ mtransforms.IdentityTransform())
586
+ self._set_lim_and_transforms()
587
+ martist._DIRTY.add(self)
588
+
589
+ set_figure.__doc__ = orig_set_figure.__doc__
590
+ cls.set_figure = set_figure
591
+
592
+ def _set_lim_and_transforms(self):
593
+ orig_set_lim_and_transforms(self)
594
+ if _rs_py_drawn(self):
595
+ return
596
+ self.transAxes._rs_spec = "axes"
597
+ self.transData._rs_spec = "data"
598
+
599
+ _set_lim_and_transforms.__doc__ = orig_set_lim_and_transforms.__doc__
600
+ cls._set_lim_and_transforms = _set_lim_and_transforms
601
+
602
+ def _gen_axes_patch(self):
603
+ p = orig_gen_axes_patch(self)
604
+ p._rs_axes_patch = True
605
+ return p
606
+
607
+ _gen_axes_patch.__doc__ = orig_gen_axes_patch.__doc__
608
+ cls._gen_axes_patch = _gen_axes_patch
609
+
610
+ def __clear(self):
611
+ rs = self._rs
612
+ children = self.__dict__.get("_children")
613
+ if isinstance(children, _RsChildren):
614
+ children._detach_pending()
615
+ rs.cla()
616
+ orig_clear(self)
617
+ if not _rs_py_drawn(self):
618
+ # (axes drawn by Python draw their children themselves, and may
619
+ # change them while drawing, e.g. parasite axes)
620
+ self._children = _RsChildren(self, self._children)
621
+ for loc, t in (("center", self.title), ("left", self._left_title),
622
+ ("right", self._right_title)):
623
+ rs.set_title_handle(loc, t._h)
624
+ t._rs_native_in = True
625
+ # matplotlib sets the spine positions when it creates the first
626
+ # ticks; the Rust core creates the ticks itself.
627
+ if not _rs_py_drawn(self):
628
+ for spine in self.spines.values():
629
+ spine._ensure_position_is_set()
630
+ self.patch.__dict__["_h"] = mpatches._RsPatchHandle(rs)
631
+ martist._DIRTY.add(self.patch)
632
+ martist._DIRTY.add(self)
633
+
634
+ cls._AxesBase__clear = __clear
635
+
636
+ def _rs_sync(self):
637
+ """Mirror position and limits into the Rust axes."""
638
+ p = self._position
639
+ o = self._originalPosition
640
+ v = self._viewLim
641
+ d = self.dataLim
642
+ mp = d.minpos
643
+ self._rs.mirror_state(
644
+ tuple(map(float, p.extents)), tuple(map(float, o.extents)),
645
+ tuple(map(float, v.extents)), tuple(map(float, d.extents)),
646
+ (float(mp[0]), float(mp[1])), float(self.zorder), bool(self.get_visible()),
647
+ bool(self.axison), bool(self._frameon),
648
+ None if self._autotitlepos is None else bool(self._autotitlepos),
649
+ None if self._rasterization_zorder is None else float(self._rasterization_zorder))
650
+
651
+ cls._rs_sync = _rs_sync
652
+
653
+ def _rs_prepare_draw(self, renderer):
654
+ """What matplotlib's ``Axes.draw`` does before drawing children."""
655
+ if _rs_py_drawn(self):
656
+ martist._DIRTY.add(self)
657
+ return
658
+ self._unstale_viewLim()
659
+ locator = self.get_axes_locator()
660
+ self.apply_aspect(locator(self, renderer) if locator else None)
661
+ for axis in self._axis_map.values():
662
+ axis._rs_sync_tickers()
663
+ martist._DIRTY.add(self)
664
+
665
+ cls._rs_prepare_draw = _rs_prepare_draw
666
+
667
+ def draw(self, renderer):
668
+ # Normally drawn by the Rust core as part of the figure.
669
+ if _rs_py_drawn(self):
670
+ return orig_draw(self, renderer)
671
+ if not self.get_visible():
672
+ return
673
+ from .._foreign import is_foreign, metrics
674
+ with metrics(renderer):
675
+ self._rs_prepare_draw(renderer)
676
+ self.get_figure(root=True)._rs_sync_all(renderer)
677
+ with martist._rs_drawing():
678
+ if is_foreign(renderer):
679
+ self._rs.draw_foreign(renderer)
680
+ elif not renderer._rs_disabled:
681
+ self._rs.draw_into(renderer._renderer)
682
+ self.stale = False
683
+
684
+ cls.draw = martist.allow_rasterization(draw)
685
+
686
+ # child axes (insets, secondary axes) are drawn among the children
687
+ orig_add_child_axes = cls.add_child_axes
688
+
689
+ @functools.wraps(orig_add_child_axes)
690
+ def add_child_axes(self, ax):
691
+ ret = orig_add_child_axes(self, ax)
692
+ crs = ax.__dict__.get("_rs")
693
+ if crs is not None:
694
+ self._rs.add_child_axes(crs.uid)
695
+ return ret
696
+
697
+ cls.add_child_axes = add_child_axes
698
+
699
+ # the legend is drawn among the children
700
+ def _get_legend_(self):
701
+ return self.__dict__.get("_rs_legend_")
702
+
703
+ def _set_legend_(self, leg):
704
+ rs = self.__dict__.get("_rs")
705
+ old = self.__dict__.get("_rs_legend_")
706
+ if old is not None and rs is not None:
707
+ rs.remove_child(old)
708
+ self.__dict__["_rs_legend_"] = leg
709
+ if leg is not None and rs is not None:
710
+ rs.add_child_raw(leg)
711
+
712
+ cls.legend_ = property(_get_legend_, _set_legend_)
713
+
714
+ # -- plain attributes that the Rust axes needs ------------------------------
715
+ cls.axison = _rs_attr("axison")
716
+ cls._frameon = _rs_attr("frameon")
717
+ cls._autotitlepos = _rs_attr("autotitlepos")
718
+
719
+ def __del__(self):
720
+ rs = self.__dict__.get("_rs")
721
+ if rs is not None:
722
+ try:
723
+ rs.figure().delaxes(rs.uid)
724
+ except Exception:
725
+ pass
726
+
727
+ cls.__del__ = __del__