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,391 @@
1
+ """Create independent boxplot artists from validated style prototypes.
2
+
3
+ bxp knows every component's numeric coordinates and reuses a handful of styles.
4
+ It need not repeat plot's format/unit parsing, clipping setup and path limits
5
+ for each of its thousands of two-point lines. The returned objects remain
6
+ ordinary, independently mutable Line2D and PathPatch instances.
7
+
8
+ When the statistics are plain floats, `_BoxplotArtists.build` handles all the
9
+ artists of a bxp call at once: the coordinates are computed with NumPy (the
10
+ same operations as bxp's loop, element by element) and handed to the Rust
11
+ axes as one `_mplrs.ArtistBatch`, which draws the artists from the arrays.
12
+ The artists themselves are created when they are first needed (see
13
+ `_base_rs._Pending`): bxp returns lists that create the artists of their
14
+ component when read, and ``Axes._children`` creates all of them when read.
15
+ An artist that is changed (or removed) makes the Rust axes draw the artists
16
+ of the call one by one, from their own handles, as if they had always
17
+ existed. ``MPLRS_LAZY=0`` creates the artists in bxp.
18
+ """
19
+ import functools
20
+ import os
21
+ import weakref
22
+
23
+ import numpy as np
24
+
25
+ from .. import _mplrs, artist, cbook, lines, patches
26
+ from ..path import Path
27
+ from ._base_rs import (
28
+ _Pending, _PendingList, _RsChildren, _rs_native, _rs_py_drawn, _rs_switch_child)
29
+
30
+
31
+ _PLAIN_FLOATS = (float, np.float64)
32
+ _PLAIN_NUMBERS = (float, int, np.float64, np.int64)
33
+
34
+ _gc_paused = cbook._gc_paused
35
+
36
+
37
+ class _Ragged:
38
+ """Rows of different lengths: the pieces of *flat* of the lengths *lengths*."""
39
+
40
+ __slots__ = ("flat", "lengths")
41
+
42
+ def __init__(self, flat, lengths):
43
+ self.flat = flat
44
+ self.lengths = lengths
45
+
46
+ def __len__(self):
47
+ return len(self.lengths)
48
+
49
+ def rows(self):
50
+ return np.split(self.flat, np.cumsum(self.lengths)[:-1])
51
+
52
+
53
+ def _dense(stats):
54
+ """The arrays of the statistics *stats* if they are still as
55
+ `cbook.boxplot_stats` computed them (see `cbook._BoxplotStats`)."""
56
+ return stats.columns if type(stats) is cbook._BoxplotStats else None
57
+
58
+
59
+ class _BoxplotArtists:
60
+ def __init__(self, axes, line_styles, patch_style):
61
+ self.axes = axes
62
+ self.children = axes._children
63
+ self.styles = {}
64
+ self.points = []
65
+ self.point_arrays = []
66
+ self.switch = functools.partial(_rs_switch_child, weakref.ref(axes))
67
+ for kw in line_styles:
68
+ key = tuple(kw.items())
69
+ hash(key) # mutable/complex styles use the ordinary creation path
70
+ if key in self.styles:
71
+ continue
72
+ prototype = lines.Line2D([], [], **kw)
73
+ self._prepare(prototype)
74
+ props = prototype._rs_props()
75
+ prototype._h.set_many(props)
76
+ self.styles[key] = prototype
77
+ self.patch_style = None
78
+ if patch_style is not None:
79
+ prototype = patches.PathPatch(Path(np.empty((0, 2))), **patch_style)
80
+ self._prepare(prototype)
81
+ props = prototype._rs_props()
82
+ prototype._h.set_many(props)
83
+ self.patch_style = prototype
84
+
85
+ def _prepare(self, prototype):
86
+ self.axes._set_artist_props(prototype)
87
+ if prototype.get_clip_path() is None:
88
+ prototype.set_clip_path(self.axes.patch)
89
+ if not _rs_native(prototype) or prototype.get_mouseover():
90
+ raise TypeError("artist requires the general creation path")
91
+ artist._DIRTY.discard(prototype)
92
+
93
+ @staticmethod
94
+ @_gc_paused
95
+ def create(axes, stats, line_styles, patch_style):
96
+ from numbers import Real
97
+ from ._axes import Axes
98
+ if (len(stats) == 0 or type(axes) is not Axes
99
+ or not isinstance(axes._children, _RsChildren) or _rs_py_drawn(axes)
100
+ or getattr(axes.plot, "__func__", None) is not Axes.plot
101
+ or getattr(axes.add_artist, "__func__", None) is not Axes.add_artist
102
+ or any(axis.have_units() for axis in axes._axis_map.values())
103
+ or any("transform" in kw for kw in line_styles)
104
+ or patch_style is not None and "transform" in patch_style):
105
+ return None
106
+ cycle_keys = axes._get_lines._prop_cycle._cycler_items[0]
107
+ if any(kw.get(key) is None for kw in line_styles for key in cycle_keys):
108
+ return None # Preserve plot's per-line advancement of property cycles.
109
+ for stat in () if _dense(stats) is not None else stats:
110
+ for k in ("q1", "q3", "med", "whislo", "whishi"):
111
+ v = stat[k]
112
+ if type(v) not in _PLAIN_FLOATS and not isinstance(v, Real):
113
+ return None
114
+ for k in ("mean", "cilo", "cihi"):
115
+ v = stat.get(k, 0.)
116
+ if type(v) not in _PLAIN_FLOATS and not isinstance(v, Real):
117
+ return None
118
+ if "fliers" in stat:
119
+ f = stat["fliers"]
120
+ if (f.dtype if type(f) is np.ndarray else np.asarray(f).dtype).kind not in "biuf":
121
+ return None
122
+ try:
123
+ return _BoxplotArtists(axes, line_styles, patch_style)
124
+ except (TypeError, NotImplementedError):
125
+ return None
126
+
127
+ def _copy(self, prototype, handle):
128
+ a = type(prototype).__new__(type(prototype))
129
+ a.__dict__ = prototype.__dict__.copy()
130
+ a._h = handle
131
+ # An independent callback registry is created on first use
132
+ # (artist._LazyCallbacks).
133
+ del a._callbacks
134
+ a._remove_method = self.axes._children.remove
135
+ a._rs_native_in = True
136
+ a._rs_switch = self.switch
137
+ # State is already installed in the native handle. Future mutations
138
+ # use the same dirty/switch machinery as conventionally added artists.
139
+ list.append(self.axes._children, a)
140
+ self.axes._rs.add_child_raw(handle)
141
+ return a
142
+
143
+ def line(self, xs, ys, kw):
144
+ prototype = self.styles[tuple(kw.items())]
145
+ x, y = np.array(xs, copy=True), np.array(ys, copy=True)
146
+ h = prototype._h.copy_with_data(x, y)
147
+ a = self._copy(prototype, h)
148
+ a._xorig, a._yorig = x, y
149
+ a._in_autoscale = True
150
+ if not a._label:
151
+ a._label = f"_child{len(self.axes._children) - 1}"
152
+ h.set("label", a._label)
153
+ self.points.extend(zip(x, y))
154
+ return a
155
+
156
+ def patch(self, xs, ys):
157
+ prototype = self.patch_style
158
+ path = Path._create_closed(np.column_stack([xs, ys]))
159
+ h = prototype._h.copy_with_path(path.vertices.tolist(), path.codes.tolist())
160
+ a = self._copy(prototype, h)
161
+ a._path = path
162
+ return a
163
+
164
+ # -- all artists of a bxp call at once ---------------------------------
165
+
166
+ def _template(self, prototype, line, switch, dead):
167
+ """The attribute dict shared (by copy) by the copies of *prototype*."""
168
+ d = prototype.__dict__.copy()
169
+ del d["_callbacks"] # (each copy creates its own on first use)
170
+ d["_remove_method"] = self.children.remove
171
+ d["_rs_native_in"] = True
172
+ d["_rs_switch"] = switch
173
+ if line:
174
+ d["_in_autoscale"] = True
175
+ if dead: # (as Axes.clear leaves its children)
176
+ d["_axes"] = d["_parent_figure"] = None
177
+ return d
178
+
179
+ def _line_slot(self, kw, xs, ys, slot, nslots, base):
180
+ """
181
+ The slot of an `_mplrs.ArtistBatch` and of a `_Pending` for Line2D
182
+ copies of the style *kw* with the rows of *xs*, *ys* as data (the
183
+ original arrays, whose dtype is that of bxp's lists); the copy for
184
+ box *i* is child ``base + i * nslots + slot``.
185
+ """
186
+ prototype = self.styles[tuple(kw.items())]
187
+ auto_label = not prototype._label
188
+ ragged = type(xs) is _Ragged # (fliers): one 1D array per box
189
+ if ragged:
190
+ offsets = np.concatenate([[0], np.cumsum(xs.lengths)]).tolist()
191
+ points = np.column_stack([xs.flat, ys.flat])
192
+ spec = ("ragged", prototype._h, xs.flat.astype(np.float64, copy=False),
193
+ ys.flat.astype(np.float64, copy=False), offsets, auto_label)
194
+ else:
195
+ points = np.column_stack([xs.ravel(), ys.ravel()])
196
+ spec = ("lines", prototype._h, np.ascontiguousarray(xs, np.float64),
197
+ np.ascontiguousarray(ys, np.float64), auto_label)
198
+
199
+ def make(handles, switch, dead):
200
+ names = ["_xorig", "_yorig"]
201
+ columns = [xs.rows(), ys.rows()] if ragged else [list(xs), list(ys)]
202
+ if auto_label:
203
+ names.append("_label")
204
+ columns.append([f"_child{base + i * nslots + slot}" for i in range(len(xs))])
205
+ return self._clones(prototype, True, handles, names, columns, switch, dead)
206
+
207
+ return spec, {"prototype": prototype, "make": make, "points": points,
208
+ "finite": bool(np.isfinite(points).all())}
209
+
210
+ def _clones(self, prototype, line, handles, names, columns, switch, dead):
211
+ """Copies of *prototype* with the Rust *handles* and, per copy, the
212
+ attributes *names* from *columns*."""
213
+ cls = type(prototype)
214
+ template = self._template(prototype, line, switch, dead)
215
+ if cls.__new__ is object.__new__:
216
+ return _mplrs.clone_instances(cls, template, handles, names, columns)
217
+ out = []
218
+ for i, h in enumerate(handles):
219
+ a = cls.__new__(cls)
220
+ d = template.copy()
221
+ d["_h"] = h
222
+ d.update((name, column[i]) for name, column in zip(names, columns))
223
+ a.__dict__ = d
224
+ out.append(a)
225
+ return out
226
+
227
+ def _patch_slot(self, verts):
228
+ """The slot (see `_line_slot`) for PathPatch copies with the closed
229
+ paths through each (m, 2) block of *verts*, as ``Path._create_closed``
230
+ makes them."""
231
+ prototype = self.patch_style
232
+ verts = np.concatenate([verts, verts[:, :1]], axis=1)
233
+ first = Path._create_closed(verts[0, :-1])
234
+ codes = first.codes
235
+ spec = ("patches", prototype._h, np.ascontiguousarray(verts, np.float64), codes.tolist())
236
+
237
+ def make(handles, switch, dead):
238
+ fast_path = Path._fast_from_codes_and_verts
239
+ paths = [first] + [fast_path(v, codes.copy(), first) for v in verts[1:]]
240
+ return self._clones(prototype, False, handles, ["_path"], [paths], switch, dead)
241
+
242
+ return spec, {"prototype": prototype, "make": make, "points": None, "finite": True}
243
+
244
+ def _lazy(self):
245
+ """Whether the artists may be created when they are needed: the Axes
246
+ does without artists that draw only inside it (see `_Pending`)."""
247
+ if os.environ.get("MPLRS_LAZY", "1") == "0":
248
+ return False
249
+ prototypes = [*self.styles.values()]
250
+ if self.patch_style is not None:
251
+ prototypes.append(self.patch_style)
252
+ return all(not p.get_animated() and p._fully_clipped_to_axes() for p in prototypes)
253
+
254
+ @_gc_paused
255
+ def build(self, bxpstats, positions, widths, capwidths, vertical, *,
256
+ showbox, patch_artist, shownotches, showcaps, showmeans, meanline,
257
+ showfliers, box_kw, whisker_kw, cap_kw, median_kw, mean_kw, flier_kw):
258
+ """
259
+ Create the artists of all boxes of a bxp call, in bxp's order.
260
+
261
+ Returns ``(whiskers, caps, boxes, medians, means, fliers)``, or None
262
+ (before creating anything) if the statistics are not plain floats,
263
+ so that bxp's per-box loop computes them with its own types.
264
+ """
265
+ if positions.dtype not in (np.int64, np.float64):
266
+ return None
267
+ for w in (widths, capwidths):
268
+ if type(w) is np.ndarray: # (its items are np.float64 or np.int64)
269
+ if w.ndim != 1 or w.dtype not in (np.float64, np.int64):
270
+ return None
271
+ elif not set(map(type, w)).issubset(_PLAIN_NUMBERS):
272
+ return None
273
+ keys = ["q1", "q3", "med", "whislo", "whishi"]
274
+ if shownotches:
275
+ keys += ["cilo", "cihi"]
276
+ if showmeans:
277
+ keys.append("mean")
278
+ dense = _dense(bxpstats)
279
+ for stat in () if dense is not None else bxpstats:
280
+ for k in keys:
281
+ if type(stat[k]) not in _PLAIN_FLOATS:
282
+ return None
283
+ if showfliers:
284
+ f = stat["fliers"]
285
+ if type(f) is not np.ndarray or f.dtype != np.float64 or f.ndim != 1:
286
+ return None
287
+
288
+ def column(key):
289
+ if dense is not None:
290
+ return dense[key]
291
+ return np.array([stat[key] for stat in bxpstats], np.float64)
292
+
293
+ def pairs(a, b):
294
+ return np.stack([a, b], axis=1)
295
+
296
+ def oriented(xs, ys):
297
+ return (xs, ys) if vertical else (ys, xs)
298
+
299
+ pos = positions
300
+ width = np.array(widths, np.float64)
301
+ capwidth = np.array(capwidths, np.float64)
302
+ q1, q3, med = column("q1"), column("q3"), column("med")
303
+ whislo, whishi = column("whislo"), column("whishi")
304
+ box_left = pos - width * 0.5
305
+ box_right = pos + width * 0.5
306
+ components = [] # (name, kind, data) in bxp's creation order per box
307
+ if shownotches:
308
+ cilo, cihi = column("cilo"), column("cihi")
309
+ notch_left = pos - width * 0.25
310
+ notch_right = pos + width * 0.25
311
+ box_x = np.stack([box_left, box_right, box_right, notch_right, box_right,
312
+ box_right, box_left, box_left, notch_left, box_left,
313
+ box_left], axis=1)
314
+ box_y = np.stack([q1, q1, cilo, med, cihi, q3, q3, cihi, med, cilo, q1], axis=1)
315
+ med_x = pairs(notch_left, notch_right)
316
+ else:
317
+ box_x = np.stack([box_left, box_right, box_right, box_left, box_left], axis=1)
318
+ box_y = np.stack([q1, q1, q3, q3, q1], axis=1)
319
+ med_x = pairs(box_left, box_right)
320
+ if showbox:
321
+ if patch_artist:
322
+ components.append(("boxes", "patch", np.stack(oriented(box_x, box_y), axis=2)))
323
+ else:
324
+ components.append(("boxes", box_kw, oriented(box_x, box_y)))
325
+ # (each component gets its own arrays: every artist's data is a row
326
+ # of its own, as bxp's loop copies its lists for every artist)
327
+ whis_x = pairs(pos, pos)
328
+ components.append(("whiskers", whisker_kw, oriented(whis_x, pairs(q1, whislo))))
329
+ components.append(("whiskers", whisker_kw, oriented(whis_x.copy(), pairs(q3, whishi))))
330
+ if showcaps:
331
+ cap_x = pairs(pos - capwidth * 0.5, pos + capwidth * 0.5)
332
+ components.append(("caps", cap_kw, oriented(cap_x, pairs(whislo, whislo))))
333
+ components.append(("caps", cap_kw, oriented(cap_x.copy(), pairs(whishi, whishi))))
334
+ components.append(("medians", median_kw, oriented(med_x, pairs(med, med))))
335
+ if showmeans:
336
+ mean = column("mean")
337
+ if meanline:
338
+ data = oriented(pairs(box_left, box_right), pairs(mean, mean))
339
+ else:
340
+ data = oriented(pos[:, None].copy(), mean[:, None])
341
+ components.append(("means", mean_kw, data))
342
+ if showfliers:
343
+ if dense is not None:
344
+ lengths, flier_y = bxpstats.counts, bxpstats.fliers
345
+ else:
346
+ fl = [stat["fliers"] for stat in bxpstats]
347
+ lengths = [len(f) for f in fl]
348
+ flier_y = np.concatenate(fl) if fl else np.empty(0)
349
+ flier_x = np.repeat(pos.astype(np.float64), lengths)
350
+ components.append(("fliers", flier_kw, oriented(_Ragged(flier_x, lengths),
351
+ _Ragged(flier_y, lengths))))
352
+
353
+ nslots = len(components)
354
+ base = len(self.children)
355
+ n = len(bxpstats)
356
+ specs, slots, where = [], [], {}
357
+ for slot, (name, kw, data) in enumerate(components):
358
+ if kw == "patch":
359
+ spec, info = self._patch_slot(data)
360
+ else:
361
+ spec, info = self._line_slot(kw, data[0], data[1], slot, nslots, base)
362
+ self.point_arrays.append(info["points"])
363
+ specs.append(spec)
364
+ slots.append(info)
365
+ where.setdefault(name, []).append(slot) # (lower and upper: per box)
366
+ pending = _Pending(self.axes, _mplrs.ArtistBatch(n, base, specs), n, slots)
367
+ self.children._add_pending(pending)
368
+ out = [_PendingList(pending, where[name]) if name in where else []
369
+ for name in ("whiskers", "caps", "boxes", "medians", "means", "fliers")]
370
+ if not self._lazy():
371
+ self.children._unpack()
372
+ out = [list(artists) for artists in out]
373
+ return tuple(out)
374
+
375
+ @staticmethod
376
+ def datalabels(bxpstats, positions):
377
+ """``[stats.get('label', pos) ...]`` for the boxes."""
378
+ if _dense(bxpstats) is None:
379
+ return [stats.get('label', pos) for pos, stats in zip(positions, bxpstats)]
380
+ labels = bxpstats.labels
381
+ if labels is None:
382
+ return list(positions)
383
+ return [pos if label is None else label for pos, label in zip(positions, labels)]
384
+
385
+ def finish(self):
386
+ if self.points:
387
+ self.axes.update_datalim(self.points)
388
+ if self.point_arrays:
389
+ self.axes.update_datalim(np.concatenate(self.point_arrays))
390
+ self.axes._request_autoscale_view()
391
+ self.axes.stale = True
@@ -0,0 +1,99 @@
1
+ """`numpy.histogram` and `numpy.histogram2d` for `Axes.hist` and
2
+ `Axes.hist2d`, counting large unweighted float64 data in Rust.
3
+
4
+ The bin edges (and the choice of numpy's equal-bins algorithm) come from
5
+ numpy's own ``_get_bin_edges``; the Rust loops are numpy's algorithms, so the
6
+ counts are the same.
7
+ """
8
+ import operator
9
+
10
+ import numpy as np
11
+
12
+ from .. import _mplrs
13
+
14
+ try: # NumPy 2
15
+ from numpy.lib._histograms_impl import _get_bin_edges, _get_outer_edges
16
+ except ImportError:
17
+ try: # NumPy 1.25, 1.26
18
+ from numpy.lib.histograms import _get_bin_edges, _get_outer_edges
19
+ except ImportError: # (numpy.histogram is used as it is)
20
+ _get_bin_edges = _get_outer_edges = None
21
+
22
+ # Below this many values numpy is used as it is.
23
+ MIN_SIZE = 1 << 16
24
+
25
+
26
+ def histogram(a, bins=10, range=None, density=None, weights=None):
27
+ """`numpy.histogram`, with the same results."""
28
+ if (weights is not None or density or type(a) is not np.ndarray
29
+ or a.dtype != np.float64 or a.size < MIN_SIZE or _get_bin_edges is None):
30
+ return np.histogram(a, bins, range=range, density=density, weights=weights)
31
+ a = a.ravel()
32
+ try:
33
+ edges, uniform = _get_bin_edges(a, bins, range, None)
34
+ except Exception: # numpy raises the same
35
+ return np.histogram(a, bins, range=range, density=density, weights=weights)
36
+ if edges.dtype != np.float64 or edges.ndim != 1 or len(edges) < 2:
37
+ return np.histogram(a, bins, range=range, density=density, weights=weights)
38
+ if uniform is not None:
39
+ first, last, n = uniform
40
+ # (numpy computes with these in float64)
41
+ if type(first) not in (float, np.float64) or type(last) not in (float, np.float64):
42
+ return np.histogram(a, bins, range=range, density=density, weights=weights)
43
+ uniform = (float(first), float(last), int(n))
44
+ elif np.isnan(edges).any():
45
+ return np.histogram(a, bins, range=range, density=density, weights=weights)
46
+ counts = _mplrs.histogram_counts(np.ascontiguousarray(a), np.ascontiguousarray(edges), uniform)
47
+ return counts.astype(np.intp, copy=False), edges
48
+
49
+
50
+ def _histdd_edges(sample, bins, range_):
51
+ """The edges `numpy.histogramdd` computes along one axis, or None if it
52
+ would raise (numpy then raises the same) or they are not float64."""
53
+ if np.ndim(bins) == 0:
54
+ if isinstance(bins, (bool, np.bool_)) or bins < 1:
55
+ return None
56
+ smin, smax = _get_outer_edges(sample, range_)
57
+ edges = np.linspace(smin, smax, operator.index(bins) + 1)
58
+ elif np.ndim(bins) == 1:
59
+ edges = np.asarray(bins)
60
+ if edges.dtype != np.float64 or np.any(edges[:-1] > edges[1:]):
61
+ return None
62
+ else:
63
+ return None
64
+ if edges.dtype != np.float64 or len(edges) < 2 or np.isnan(edges).any():
65
+ return None
66
+ return edges
67
+
68
+
69
+ def histogram2d(x, y, bins=10, range=None, density=None, weights=None):
70
+ """`numpy.histogram2d`, with the same results."""
71
+ def numpy():
72
+ return np.histogram2d(x, y, bins=bins, range=range, density=density, weights=weights)
73
+
74
+ if (weights is not None or density or _get_outer_edges is None
75
+ or not all(type(v) is np.ndarray and v.dtype == np.float64 and v.ndim == 1
76
+ for v in (x, y))
77
+ or len(x) != len(y) or len(x) < MIN_SIZE):
78
+ return numpy()
79
+ try:
80
+ n = len(bins)
81
+ except TypeError:
82
+ n = 1
83
+ b = bins
84
+ if n not in {1, 2}:
85
+ b = [np.asarray(bins)] * 2
86
+ elif n == 1:
87
+ b = [bins, bins] if np.ndim(bins) == 0 else None
88
+ if b is None or (range is not None and len(range) != 2):
89
+ return numpy()
90
+ r = (None, None) if range is None else range
91
+ try:
92
+ edges = [_histdd_edges(v, bi, ri) for v, bi, ri in zip((x, y), b, r)]
93
+ except Exception: # numpy raises the same
94
+ return numpy()
95
+ if edges[0] is None or edges[1] is None:
96
+ return numpy()
97
+ h = _mplrs.histogram2d_counts(np.ascontiguousarray(x), np.ascontiguousarray(y),
98
+ edges[0], edges[1])
99
+ return h, edges[0], edges[1]