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
Binary file
matplotlib_rs/_path.py ADDED
@@ -0,0 +1,25 @@
1
+ """Rust implementations of matplotlib's ``_path`` extension module."""
2
+ import numpy as np
3
+
4
+ from ._mplrs import _path as _impl
5
+
6
+ affine_transform = _impl.affine_transform
7
+ is_sorted_and_has_non_nan = _impl.is_sorted_and_has_non_nan
8
+ cleanup_path = _impl.cleanup_path
9
+ convert_path_to_polygons = _impl.convert_path_to_polygons
10
+ get_path_collection_extents = _impl.get_path_collection_extents
11
+ point_in_path = _impl.point_in_path
12
+ points_in_path = _impl.points_in_path
13
+ path_in_path = _impl.path_in_path
14
+ point_in_path_collection = _impl.point_in_path_collection
15
+ path_intersects_path = _impl.path_intersects_path
16
+ path_intersects_rectangle = _impl.path_intersects_rectangle
17
+ clip_path_to_rect = _impl.clip_path_to_rect
18
+ convert_to_string = _impl.convert_to_string
19
+ legend_badness = _impl.legend_badness
20
+
21
+
22
+ def count_bboxes_overlapping_bbox(bbox, bboxes):
23
+ return _impl.count_bboxes_overlapping_bbox(
24
+ np.asarray(bbox, dtype=float), np.asarray(bboxes, dtype=float).reshape(-1, 2, 2))
25
+
matplotlib_rs/_png.py ADDED
@@ -0,0 +1,162 @@
1
+ """
2
+ PNG reading and writing in the Rust core (Pillow is never used).
3
+
4
+ Rows are filtered with libpng's (and Pillow's) heuristic and deflated at zlib
5
+ level 6 by default, as Pillow does, in strips compressed on several threads
6
+ (``MPLRS_THREADS``). `native_options` reads the compression options of
7
+ ``pil_kwargs`` with Pillow's meaning; `._imageio` handles the others.
8
+
9
+ `read` returns the same arrays as matplotlib's Pillow-based ``imread``
10
+ (``_pil_png_to_float_array``): float32 values in [0, 1]; grayscale images are
11
+ 2D, palette and grayscale+alpha images are expanded to RGBA, and 16-bit color
12
+ samples are truncated to their most significant byte as Pillow does.
13
+ """
14
+
15
+ import os
16
+
17
+ import numpy as np
18
+
19
+ from . import _mplrs
20
+
21
+ #: The zlib level of Pillow's PNG writer (``compress_level=-1``).
22
+ DEFAULT_LEVEL = 6
23
+
24
+ #: The ``pil_kwargs`` of a PNG save that `native_options` reads, with
25
+ #: Pillow's meaning: ``optimize`` (zlib level 9), ``compress_level`` (0-9,
26
+ #: -1 for the default), ``compress_type`` (the zlib strategy, 0-4, -1 for the
27
+ #: default), ``dpi`` (an (x, y) pair for the pHYs chunk) and ``format``.
28
+ NATIVE_PIL_KWARGS = frozenset({"optimize", "compress_level", "compress_type", "dpi", "format"})
29
+
30
+
31
+ def native_options(pil_kwargs):
32
+ """
33
+ The zlib ``(level, strategy)`` and pHYs ``dpi`` (an (x, y) pair, or None
34
+ if not given) of a PNG save with *pil_kwargs* (a dict or None), or None if
35
+ *pil_kwargs* has other options (see `._imageio`).
36
+ """
37
+ pil_kwargs = pil_kwargs or {}
38
+ if not NATIVE_PIL_KWARGS.issuperset(pil_kwargs):
39
+ return None
40
+ if str(pil_kwargs.get("format", "png")).lower() != "png":
41
+ return None
42
+ level = pil_kwargs.get("compress_level", -1)
43
+ strategy = pil_kwargs.get("compress_type", -1)
44
+ if pil_kwargs.get("optimize", False):
45
+ level = 9 # Pillow's ZipEncoder: optimize means Z_BEST_COMPRESSION
46
+ if not isinstance(level, (int, np.integer)) or not -1 <= level <= 9:
47
+ raise ValueError(f"compress_level must be an integer from -1 to 9, not {level!r}")
48
+ if not isinstance(strategy, (int, np.integer)) or not -1 <= strategy <= 4:
49
+ raise ValueError(f"compress_type must be an integer from -1 to 4, not {strategy!r}")
50
+ dpi = pil_kwargs.get("dpi")
51
+ if dpi:
52
+ dpi = (float(dpi[0]), float(dpi[1]))
53
+ else:
54
+ dpi = None
55
+ return (DEFAULT_LEVEL if level == -1 else int(level),
56
+ 0 if strategy == -1 else int(strategy), dpi)
57
+
58
+
59
+ def text_chunks(metadata):
60
+ """
61
+ The (keyword, text) pairs of the text chunks Pillow's ``PngInfo.add_text``
62
+ writes for the items of the dict *metadata*, skipping None values; bytes
63
+ are Latin-1. Keywords must be Latin-1; texts that are not are written as
64
+ UTF-8 iTXt chunks.
65
+ """
66
+ items = []
67
+ for key, value in metadata.items():
68
+ if value is None:
69
+ continue
70
+ if isinstance(key, bytes):
71
+ key = key.decode("latin-1")
72
+ else:
73
+ key = str(key)
74
+ key.encode("latin-1", "strict") # raises as PngInfo.add_text does
75
+ if isinstance(value, bytes):
76
+ value = value.decode("latin-1")
77
+ items.append((key, str(value)))
78
+ return items
79
+
80
+
81
+ def _dpi_pair(dpi):
82
+ if dpi is None:
83
+ return None
84
+ if np.ndim(dpi) == 0:
85
+ return None if dpi <= 0 else (float(dpi), float(dpi))
86
+ return (float(dpi[0]), float(dpi[1]))
87
+
88
+
89
+ def encode(rgba, dpi=None, text=(), level=DEFAULT_LEVEL, strategy=0):
90
+ """
91
+ PNG file contents of the (h, w, 4) uint8 array *rgba* (or an (h, w) gray,
92
+ (h, w, 2) gray + alpha or (h, w, 3) RGB array), with a pHYs chunk if *dpi*
93
+ (a number > 0 or an (x, y) pair) is given, the text chunks *text* (pairs
94
+ of str, as from `text_chunks`) and the zlib *level* and *strategy*.
95
+ """
96
+ rgba = np.asarray(rgba, dtype=np.uint8)
97
+ if not (rgba.ndim == 2 or rgba.ndim == 3 and 1 <= rgba.shape[2] <= 4):
98
+ raise ValueError(f"expected an RGBA array, not one of shape {rgba.shape}")
99
+ return _mplrs.encode_png(rgba, _dpi_pair(dpi), [(str(k), str(v)) for k, v in text],
100
+ level, strategy)
101
+
102
+
103
+ def write_bytes(fname, data):
104
+ """Write *data* to the path or binary file *fname* (as ``PIL.Image.save``)."""
105
+ if isinstance(fname, (str, bytes, os.PathLike)):
106
+ with open(fname, "wb") as fh:
107
+ fh.write(data)
108
+ else:
109
+ fname.write(data)
110
+ if hasattr(fname, "flush"):
111
+ fname.flush()
112
+
113
+
114
+ def write(fname, rgba, dpi=None, text=(), level=DEFAULT_LEVEL, strategy=0):
115
+ """Write `encode` (*rgba*, *dpi*, *text*, *level*, *strategy*) to a path or
116
+ binary file."""
117
+ write_bytes(fname, encode(rgba, dpi, text, level, strategy))
118
+
119
+
120
+ def _unpack(samples, height, width, channels, depth):
121
+ """The samples of each row as one uint8/uint16 array per channel."""
122
+ if depth == 16:
123
+ a = np.frombuffer(samples, ">u2").reshape(height, width * channels)
124
+ return a.astype(np.uint16)
125
+ stride = (width * channels * depth + 7) // 8
126
+ raw = np.frombuffer(samples, np.uint8).reshape(height, stride)
127
+ if depth == 8:
128
+ return raw[:, :width * channels]
129
+ bits = np.unpackbits(raw, axis=1)[:, :width * channels * depth]
130
+ bits = bits.reshape(height, width * channels, depth)
131
+ weights = (1 << np.arange(depth - 1, -1, -1)).astype(np.uint8)
132
+ return (bits * weights).sum(axis=2, dtype=np.uint8)
133
+
134
+
135
+ def read(fname):
136
+ """Read a PNG file (path or binary file) as a float32 array."""
137
+ if isinstance(fname, (str, os.PathLike)):
138
+ with open(fname, "rb") as fh:
139
+ data = fh.read()
140
+ else:
141
+ data = fname.read()
142
+ width, height, color, depth, samples, palette, trns = _mplrs.decode_png(data)
143
+ channels = {0: 1, 2: 3, 3: 1, 4: 2, 6: 4}[color]
144
+ a = _unpack(samples, height, width, channels, depth)
145
+ if color == 0: # grayscale (any transparency chunk is ignored, as by Pillow)
146
+ if depth == 1:
147
+ return a.astype(np.float32)
148
+ return np.divide(a, 2 ** depth - 1, dtype=np.float32)
149
+ if color == 3: # palette, expanded to RGBA
150
+ pal = np.frombuffer(palette, np.uint8).reshape(-1, 3)
151
+ lut = np.full((256, 4), 255, np.uint8)
152
+ lut[:len(pal), :3] = pal
153
+ if trns is not None:
154
+ alpha = np.frombuffer(trns, np.uint8)
155
+ lut[:len(alpha), 3] = alpha
156
+ return np.divide(lut[a], 2 ** 8 - 1, dtype=np.float32)
157
+ if depth == 16: # Pillow keeps the most significant byte of each sample
158
+ a = (a >> 8).astype(np.uint8)
159
+ a = a.reshape(height, width, channels)
160
+ if color == 4: # grayscale + alpha, expanded to RGBA
161
+ a = np.concatenate([a[..., :1], a[..., :1], a[..., :1], a[..., 1:]], axis=2)
162
+ return np.divide(a, 2 ** 8 - 1, dtype=np.float32)
@@ -0,0 +1,137 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Manage figures for the pyplot interface.
4
+ """
5
+
6
+ import atexit
7
+ from collections import OrderedDict
8
+
9
+
10
+ class Gcf:
11
+ """
12
+ Singleton to maintain the relation between figures and their managers, and
13
+ keep track of and "active" figure and manager.
14
+
15
+ The canvas of a figure created through pyplot is associated with a figure
16
+ manager, which handles the interaction between the figure and the backend.
17
+ pyplot keeps track of figure managers using an identifier, the "figure
18
+ number" or "manager number" (which can actually be any hashable value);
19
+ this number is available as the :attr:`number` attribute of the manager.
20
+
21
+ This class is never instantiated; it consists of an `OrderedDict` mapping
22
+ figure/manager numbers to managers, and a set of class methods that
23
+ manipulate this `OrderedDict`.
24
+
25
+ Attributes
26
+ ----------
27
+ figs : OrderedDict
28
+ `OrderedDict` mapping numbers to managers; the active manager is at the
29
+ end.
30
+ """
31
+
32
+ figs = OrderedDict()
33
+
34
+ @classmethod
35
+ def get_fig_manager(cls, num):
36
+ """
37
+ If manager number *num* exists, make it the active one and return it;
38
+ otherwise return *None*.
39
+ """
40
+ manager = cls.figs.get(num, None)
41
+ if manager is not None:
42
+ cls.set_active(manager)
43
+ return manager
44
+
45
+ @classmethod
46
+ def destroy(cls, num):
47
+ """
48
+ Destroy manager *num* -- either a manager instance or a manager number.
49
+
50
+ In the interactive backends, this is bound to the window "destroy" and
51
+ "delete" events.
52
+
53
+ It is recommended to pass a manager instance, to avoid confusion when
54
+ two managers share the same number.
55
+ """
56
+ if all(hasattr(num, attr) for attr in ["num", "destroy"]):
57
+ # num is a manager-like instance (not necessarily a
58
+ # FigureManagerBase subclass)
59
+ manager = num
60
+ if cls.figs.get(manager.num) is manager:
61
+ cls.figs.pop(manager.num)
62
+ else:
63
+ try:
64
+ manager = cls.figs.pop(num)
65
+ except KeyError:
66
+ return
67
+ if hasattr(manager, "_cidgcf"):
68
+ manager.canvas.mpl_disconnect(manager._cidgcf)
69
+ manager.destroy()
70
+
71
+ @classmethod
72
+ def destroy_fig(cls, fig):
73
+ """Destroy figure *fig*."""
74
+ manager = next((manager for manager in cls.figs.values()
75
+ if manager.canvas.figure == fig), None)
76
+ if manager is not None:
77
+ cls.destroy(manager)
78
+
79
+ @classmethod
80
+ def destroy_all(cls):
81
+ """Destroy all figures."""
82
+ for manager in list(cls.figs.values()):
83
+ manager.canvas.mpl_disconnect(manager._cidgcf)
84
+ manager.destroy()
85
+ cls.figs.clear()
86
+
87
+ @classmethod
88
+ def has_fignum(cls, num):
89
+ """Return whether figure number *num* exists."""
90
+ return num in cls.figs
91
+
92
+ @classmethod
93
+ def get_all_fig_managers(cls):
94
+ """Return a list of figure managers."""
95
+ return list(cls.figs.values())
96
+
97
+ @classmethod
98
+ def get_num_fig_managers(cls):
99
+ """Return the number of figures being managed."""
100
+ return len(cls.figs)
101
+
102
+ @classmethod
103
+ def get_active(cls):
104
+ """Return the active manager, or *None* if there is no manager."""
105
+ return next(reversed(cls.figs.values())) if cls.figs else None
106
+
107
+ @classmethod
108
+ def _set_new_active_manager(cls, manager):
109
+ """Adopt *manager* into pyplot and make it the active manager."""
110
+ if not hasattr(manager, "_cidgcf"):
111
+ manager._cidgcf = manager.canvas.mpl_connect(
112
+ "button_press_event", lambda event: cls.set_active(manager))
113
+ fig = manager.canvas.figure
114
+ fig._number = manager.num
115
+ label = fig.get_label()
116
+ if label:
117
+ manager.set_window_title(label)
118
+ cls.set_active(manager)
119
+
120
+ @classmethod
121
+ def set_active(cls, manager):
122
+ """Make *manager* the active manager."""
123
+ cls.figs[manager.num] = manager
124
+ cls.figs.move_to_end(manager.num)
125
+
126
+ @classmethod
127
+ def draw_all(cls, force=False):
128
+ """
129
+ Redraw all stale managed figures, or, if *force* is True, all managed
130
+ figures.
131
+ """
132
+ for manager in cls.get_all_fig_managers():
133
+ if force or manager.canvas.figure.stale:
134
+ manager.canvas.draw_idle()
135
+
136
+
137
+ atexit.register(Gcf.destroy_all)
@@ -0,0 +1,66 @@
1
+ """
2
+ Replacement for matplotlib's ``_qhull`` extension module (Delaunay
3
+ triangulation).
4
+
5
+ The triangulation is computed by the qhull library matplotlib builds
6
+ (extern/qhull, compiled into the Rust extension) with matplotlib's options and
7
+ post-processing, so that the triangles, their order and the order of their
8
+ vertices are identical. Set the environment variable ``MPLRS_QHULL=rust`` to
9
+ use the Rust Delaunay triangulation instead: it has the same triangles,
10
+ possibly in another order.
11
+ """
12
+
13
+ import os
14
+
15
+ import numpy as np
16
+
17
+ from . import _mplrs
18
+
19
+
20
+ def _at_least_3_unique_points(x, y):
21
+ unique2 = 0
22
+ for i in range(1, len(x)):
23
+ if unique2 == 0:
24
+ if x[i] != x[0] or y[i] != y[0]:
25
+ unique2 = i
26
+ elif ((x[i] != x[0] or y[i] != y[0])
27
+ and (x[i] != x[unique2] or y[i] != y[unique2])):
28
+ return True
29
+ return False
30
+
31
+
32
+ def delaunay(x, y, verbose):
33
+ """
34
+ Compute a Delaunay triangulation.
35
+
36
+ Parameters
37
+ ----------
38
+ x, y : 1d arrays
39
+ The coordinates of the point set, which must consist of at least
40
+ three unique points.
41
+ verbose : int
42
+ Python's verbosity level.
43
+
44
+ Returns
45
+ -------
46
+ triangles, neighbors : int arrays, shape (ntri, 3)
47
+ Indices of triangle vertices and indices of triangle neighbors.
48
+ """
49
+ x = np.ascontiguousarray(x, dtype=np.float64)
50
+ y = np.ascontiguousarray(y, dtype=np.float64)
51
+ if x.ndim != 1 or y.ndim != 1:
52
+ raise ValueError("x and y must be 1D arrays")
53
+ if x.shape[0] != y.shape[0]:
54
+ raise ValueError("x and y must be 1D arrays of the same length")
55
+ if x.shape[0] < 3:
56
+ raise ValueError("x and y arrays must have a length of at least 3")
57
+ if not _at_least_3_unique_points(x, y):
58
+ raise ValueError("x and y arrays must consist of at least 3 unique points")
59
+ if os.environ.get("MPLRS_QHULL") == "rust":
60
+ return _mplrs.delaunay(x, y)
61
+ return _mplrs.qhull_delaunay(x, y, verbose)
62
+
63
+
64
+ def version():
65
+ """Return the qhull version string."""
66
+ return _mplrs.qhull_version()
@@ -0,0 +1,84 @@
1
+ """Mirror rcParams into the Rust rc store (typed values)."""
2
+ from enum import Enum
3
+ import re
4
+
5
+ from . import _mplrs
6
+
7
+ _SPECIAL_STR = {"auto", "inherit", "none", "edge", "face", "fill", "round", "None"}
8
+ _CN = re.compile(r"\AC[0-9]+\Z")
9
+
10
+
11
+ def _is_colorkey(k):
12
+ return "color" in k
13
+
14
+
15
+ def _is_num(x):
16
+ return isinstance(x, (int, float)) and not isinstance(x, bool)
17
+
18
+
19
+ def convert(key, v):
20
+ """Return (kind, value) for the Rust store, or None to skip."""
21
+ if isinstance(v, Enum):
22
+ v = v.value
23
+ if key == "axes.prop_cycle":
24
+ from .colors import to_rgba
25
+ try:
26
+ cols = v.by_key().get("color", [])
27
+ except Exception:
28
+ cols = []
29
+ return ("colorlist", [tuple(map(float, to_rgba(c))) for c in cols])
30
+ if isinstance(v, bool):
31
+ return ("bool", v)
32
+ if _is_num(v):
33
+ return ("num", float(v))
34
+ if v is None:
35
+ return ("none", None)
36
+ if isinstance(v, str):
37
+ if _is_colorkey(key) and v not in _SPECIAL_STR:
38
+ from .colors import to_rgba
39
+ try:
40
+ return ("color", tuple(map(float, to_rgba(v))))
41
+ except (ValueError, TypeError, KeyError):
42
+ pass
43
+ return ("str", v)
44
+ if isinstance(v, (list, tuple)):
45
+ if _is_colorkey(key) and len(v) in (3, 4) and all(_is_num(x) for x in v):
46
+ return ("color", tuple(float(x) for x in v))
47
+ if all(_is_num(x) for x in v):
48
+ return ("numlist", [float(x) for x in v])
49
+ if all(isinstance(x, str) for x in v):
50
+ return ("strlist", list(v))
51
+ return None
52
+ return None
53
+
54
+
55
+ def push(key, val):
56
+ c = convert(key, val)
57
+ if c is not None:
58
+ _mplrs.rc_set({key: c})
59
+ if key == "axes.prop_cycle":
60
+ # colours given as "CN" depend on the property cycle
61
+ from . import rcParams
62
+ upd = {}
63
+ for k in rcParams.keys():
64
+ if _is_colorkey(k):
65
+ raw = rcParams._get(k)
66
+ if isinstance(raw, str) and _CN.match(raw):
67
+ cc = convert(k, raw)
68
+ if cc is not None:
69
+ upd[k] = cc
70
+ if upd:
71
+ _mplrs.rc_set(upd)
72
+
73
+
74
+ def push_all(rc):
75
+ out = {}
76
+ pc = rc._get("axes.prop_cycle") if "axes.prop_cycle" in rc else None
77
+ if pc is not None:
78
+ out["axes.prop_cycle"] = convert("axes.prop_cycle", pc)
79
+ _mplrs.rc_set({"axes.prop_cycle": out["axes.prop_cycle"]})
80
+ for k in rc.keys():
81
+ c = convert(k, rc._get(k))
82
+ if c is not None:
83
+ out[k] = c
84
+ _mplrs.rc_set(out)
@@ -0,0 +1,108 @@
1
+ """
2
+ The Rust side of `matplotlib.spines.Spine`.
3
+
4
+ The four spines of a rectilinear Axes are drawn by the Rust axes, which
5
+ positions them (and the ticks along them) at draw time. The Python
6
+ `Spine` keeps matplotlib's state and logic; its drawing properties, position
7
+ and bounds are mirrored into the Rust spine.
8
+ """
9
+
10
+ import functools
11
+
12
+ from . import artist as martist
13
+
14
+ _SPINES = ("left", "right", "bottom", "top")
15
+
16
+ # properties handled by the Rust spine itself
17
+ _SKIP = {"generic", "transform", "clip_box", "sticky_x", "sticky_y"}
18
+
19
+
20
+ class _RsSpineHandle:
21
+ """`set_many` / `get` on one spine of a Rust axes."""
22
+
23
+ def __init__(self, rs, name):
24
+ self._rs = rs
25
+ self._name = name
26
+
27
+ def set(self, key, value):
28
+ if key not in _SKIP:
29
+ self._rs.spine_set(self._name, key, value)
30
+
31
+ def set_many(self, d):
32
+ for k, v in d.items():
33
+ if k not in _SKIP:
34
+ self._rs.spine_set(self._name, k, v)
35
+
36
+ def get(self, key):
37
+ return self._rs.spine_get(self._name, key)
38
+
39
+ def ident(self):
40
+ return (id(self._rs), self._name)
41
+
42
+
43
+ def _patch_spines(Spine):
44
+ orig_init = Spine.__init__
45
+
46
+ @functools.wraps(orig_init)
47
+ def __init__(self, axes, spine_type, path, **kwargs):
48
+ orig_init(self, axes, spine_type, path, **kwargs)
49
+ rs = getattr(axes, "_rs", None)
50
+ from .axes._base_rs import _rs_py_drawn
51
+ if rs is not None and spine_type in _SPINES and not _rs_py_drawn(axes):
52
+ self.__dict__["_h"] = _RsSpineHandle(rs, spine_type)
53
+ martist._DIRTY.add(self)
54
+
55
+ Spine.__init__ = __init__
56
+
57
+ orig_props = Spine._rs_props
58
+
59
+ def _rs_props(self):
60
+ d = orig_props(self)
61
+ if not isinstance(self.__dict__.get("_h"), _RsSpineHandle):
62
+ return d
63
+ pos = self._position
64
+ if pos is not None and not isinstance(pos, str):
65
+ pos = (str(pos[0]), float(pos[1]))
66
+ d["position"] = pos
67
+ d["bounds"] = None if self._bounds is None else tuple(map(float, self._bounds))
68
+ return d
69
+
70
+ Spine._rs_props = _rs_props
71
+
72
+ orig_draw = Spine.draw
73
+
74
+ def draw(self, renderer):
75
+ if isinstance(self.__dict__.get("_h"), _RsSpineHandle):
76
+ # drawn by the Rust core as part of its Axes
77
+ self.stale = False
78
+ return
79
+ return orig_draw(self, renderer)
80
+
81
+ Spine.draw = martist.allow_rasterization(draw)
82
+
83
+
84
+ def _patch_spines_container(Spines, Spine):
85
+ """Spines other than the four of a rectilinear Axes (e.g. a colorbar's
86
+ outline) are drawn among the Axes children."""
87
+ orig_setitem = Spines.__setitem__
88
+
89
+ def __setitem__(self, key, value):
90
+ old = self._dict.get(key)
91
+ orig_setitem(self, key, value)
92
+ if isinstance(value, Spine) and not isinstance(value.__dict__.get("_h"), _RsSpineHandle):
93
+ ax = value.axes
94
+ rs = getattr(ax, "_rs", None) if ax is not None else None
95
+ if rs is None:
96
+ return
97
+ if old is not None and old is not value:
98
+ rs.remove_child(old)
99
+ from .axes._base_rs import _rs_native
100
+ value._rs_native_in = _rs_native(value)
101
+ if value._rs_native_in:
102
+ martist._DIRTY.discard(value)
103
+ value._rs_sync()
104
+ rs.add_child_raw(value._h)
105
+ else:
106
+ rs.add_child_raw(value)
107
+
108
+ Spines.__setitem__ = __setitem__
@@ -0,0 +1,52 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ import collections.abc
3
+ import itertools
4
+
5
+ import numpy as np
6
+
7
+ import matplotlib_rs.cbook as cbook
8
+ import matplotlib_rs.colors as mcolors
9
+ import matplotlib_rs.lines as mlines
10
+
11
+
12
+ def check_non_empty(key, value):
13
+ """Raise a TypeError if an empty sequence is passed"""
14
+ if (not cbook.is_scalar_or_string(value) and
15
+ isinstance(value, collections.abc.Sized) and len(value) == 0):
16
+ raise TypeError(f'{key} must not be an empty sequence')
17
+
18
+
19
+ def style_generator(kw):
20
+ """
21
+ Helper for handling style sequences (e.g. facecolor=['r', 'b', 'k']) within plotting
22
+ methods that repeatedly call other plotting methods (e.g. hist, stackplot). Remove
23
+ style keywords from the given dictionary. Return the reduced dictionary together
24
+ with a generator which provides a series of dictionaries to be used in each call to
25
+ the wrapped function.
26
+ """
27
+ kw_iterators = {}
28
+ remaining_kw = {}
29
+ for key, value in kw.items():
30
+ if key in ['facecolor', 'edgecolor']:
31
+ if value is None or cbook._str_lower_equal(value, 'none'):
32
+ kw_iterators[key] = itertools.repeat(value)
33
+ else:
34
+ check_non_empty(key, value)
35
+ kw_iterators[key] = itertools.cycle(mcolors.to_rgba_array(value))
36
+
37
+ elif key in ['hatch', 'linewidth']:
38
+ check_non_empty(key, value)
39
+ kw_iterators[key] = itertools.cycle(np.atleast_1d(value))
40
+
41
+ elif key == 'linestyle':
42
+ check_non_empty(key, value)
43
+ kw_iterators[key] = itertools.cycle(mlines._get_dash_patterns(value))
44
+
45
+ else:
46
+ remaining_kw[key] = value
47
+
48
+ def style_gen():
49
+ while True:
50
+ yield {key: next(val) for key, val in kw_iterators.items()}
51
+
52
+ return remaining_kw, style_gen()
@@ -0,0 +1,51 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Low-level text helper utilities.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from collections.abc import Iterator
9
+
10
+ from . import _api
11
+ from .ft2font import FT2Font, CharacterCodeType, LayoutItem, LoadFlags
12
+
13
+
14
+ def warn_on_missing_glyph(codepoint: CharacterCodeType, fontnames: str):
15
+ _api.warn_external(
16
+ f"Glyph {codepoint} "
17
+ f"({chr(codepoint).encode('ascii', 'namereplace').decode('ascii')}) "
18
+ f"missing from font(s) {fontnames}.")
19
+
20
+
21
+ def layout(string: str, font: FT2Font, *,
22
+ features: tuple[str] | None = None,
23
+ language: str | tuple[tuple[str, int, int], ...] | None = None
24
+ ) -> Iterator[LayoutItem]:
25
+ """
26
+ Render *string* with *font*.
27
+
28
+ For each character in *string*, yield a LayoutItem instance. When such an instance
29
+ is yielded, the font's glyph is set to the corresponding character.
30
+
31
+ Parameters
32
+ ----------
33
+ string : str
34
+ The string to be rendered.
35
+ font : FT2Font
36
+ The font.
37
+ features : tuple of str, optional
38
+ The font features to apply to the text.
39
+ language : str, optional
40
+ The language of the text in a format accepted by libraqm, namely `a BCP47
41
+ language code <https://www.w3.org/International/articles/language-tags/>`_.
42
+
43
+ Yields
44
+ ------
45
+ LayoutItem
46
+ """
47
+ for raqm_item in font._layout(string, LoadFlags.NO_HINTING,
48
+ features=features, language=language):
49
+ raqm_item.ft_object.load_glyph(raqm_item.glyph_index,
50
+ flags=LoadFlags.NO_HINTING)
51
+ yield raqm_item