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,812 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Default legend handlers.
4
+
5
+ .. important::
6
+
7
+ This is a low-level legend API, which most end users do not need.
8
+
9
+ We recommend that you are familiar with the :ref:`legend guide
10
+ <legend_guide>` before reading this documentation.
11
+
12
+ Legend handlers are expected to be a callable object with a following
13
+ signature::
14
+
15
+ legend_handler(legend, orig_handle, fontsize, handlebox)
16
+
17
+ Where *legend* is the legend itself, *orig_handle* is the original
18
+ plot, *fontsize* is the fontsize in pixels, and *handlebox* is an
19
+ `.OffsetBox` instance. Within the call, you should create relevant
20
+ artists (using relevant properties from the *legend* and/or
21
+ *orig_handle*) and add them into the *handlebox*. The artists need to
22
+ be scaled according to the *fontsize* (note that the size is in pixels,
23
+ i.e., this is dpi-scaled value).
24
+
25
+ This module includes definition of several legend handler classes
26
+ derived from the base class (HandlerBase) with the following method::
27
+
28
+ def legend_artist(self, legend, orig_handle, fontsize, handlebox)
29
+ """
30
+
31
+ from itertools import cycle
32
+
33
+ import numpy as np
34
+
35
+ from matplotlib_rs import cbook
36
+ from matplotlib_rs.lines import Line2D
37
+ from matplotlib_rs.patches import Rectangle
38
+ import matplotlib_rs.collections as mcoll
39
+
40
+
41
+ def update_from_first_child(tgt, src):
42
+ first_child = next(iter(src.get_children()), None)
43
+ if first_child is not None:
44
+ tgt.update_from(first_child)
45
+
46
+
47
+ class HandlerBase:
48
+ """
49
+ A base class for default legend handlers.
50
+
51
+ The derived classes are meant to override *create_artists* method, which
52
+ has the following signature::
53
+
54
+ def create_artists(self, legend, orig_handle,
55
+ xdescent, ydescent, width, height, fontsize,
56
+ trans):
57
+
58
+ The overridden method needs to create artists of the given
59
+ transform that fits in the given dimension (xdescent, ydescent,
60
+ width, height) that are scaled by fontsize if necessary.
61
+
62
+ """
63
+ def __init__(self, xpad=0., ypad=0., update_func=None):
64
+ """
65
+ Parameters
66
+ ----------
67
+ xpad : float, optional
68
+ Padding in x-direction.
69
+ ypad : float, optional
70
+ Padding in y-direction.
71
+ update_func : callable, optional
72
+ Function for updating the legend handler properties from another
73
+ legend handler, used by `~HandlerBase.update_prop`.
74
+ """
75
+ self._xpad, self._ypad = xpad, ypad
76
+ self._update_prop_func = update_func
77
+
78
+ def _update_prop(self, legend_handle, orig_handle):
79
+ if self._update_prop_func is None:
80
+ self._default_update_prop(legend_handle, orig_handle)
81
+ else:
82
+ self._update_prop_func(legend_handle, orig_handle)
83
+
84
+ def _default_update_prop(self, legend_handle, orig_handle):
85
+ legend_handle.update_from(orig_handle)
86
+
87
+ def update_prop(self, legend_handle, orig_handle, legend):
88
+
89
+ self._update_prop(legend_handle, orig_handle)
90
+
91
+ legend._set_artist_props(legend_handle)
92
+ legend_handle.set_clip_box(None)
93
+ legend_handle.set_clip_path(None)
94
+
95
+ def adjust_drawing_area(self, legend, orig_handle,
96
+ xdescent, ydescent, width, height, fontsize,
97
+ ):
98
+ xdescent = xdescent - self._xpad * fontsize
99
+ ydescent = ydescent - self._ypad * fontsize
100
+ width = width - self._xpad * fontsize
101
+ height = height - self._ypad * fontsize
102
+ return xdescent, ydescent, width, height
103
+
104
+ def legend_artist(self, legend, orig_handle,
105
+ fontsize, handlebox):
106
+ """
107
+ Return the artist that this HandlerBase generates for the given
108
+ original artist/handle.
109
+
110
+ Parameters
111
+ ----------
112
+ legend : `~matplotlib.legend.Legend`
113
+ The legend for which these legend artists are being created.
114
+ orig_handle : :class:`matplotlib.artist.Artist` or similar
115
+ The object for which these legend artists are being created.
116
+ fontsize : int
117
+ The fontsize in pixels. The artists being created should
118
+ be scaled according to the given fontsize.
119
+ handlebox : `~matplotlib.offsetbox.OffsetBox`
120
+ The box which has been created to hold this legend entry's
121
+ artists. Artists created in the `legend_artist` method must
122
+ be added to this handlebox inside this method.
123
+
124
+ """
125
+ xdescent, ydescent, width, height = self.adjust_drawing_area(
126
+ legend, orig_handle,
127
+ handlebox.xdescent, handlebox.ydescent,
128
+ handlebox.width, handlebox.height,
129
+ fontsize)
130
+ artists = self.create_artists(legend, orig_handle,
131
+ xdescent, ydescent, width, height,
132
+ fontsize, handlebox.get_transform())
133
+
134
+ # create_artists will return a list of artists.
135
+ for a in artists:
136
+ handlebox.add_artist(a)
137
+
138
+ # we only return the first artist
139
+ return artists[0]
140
+
141
+ def create_artists(self, legend, orig_handle,
142
+ xdescent, ydescent, width, height, fontsize,
143
+ trans):
144
+ """
145
+ Return the legend artists generated.
146
+
147
+ Parameters
148
+ ----------
149
+ legend : `~matplotlib.legend.Legend`
150
+ The legend for which these legend artists are being created.
151
+ orig_handle : `~matplotlib.artist.Artist` or similar
152
+ The object for which these legend artists are being created.
153
+ xdescent, ydescent, width, height : int
154
+ The rectangle (*xdescent*, *ydescent*, *width*, *height*) that the
155
+ legend artists being created should fit within.
156
+ fontsize : int
157
+ The fontsize in pixels. The legend artists being created should
158
+ be scaled according to the given fontsize.
159
+ trans : `~matplotlib.transforms.Transform`
160
+ The transform that is applied to the legend artists being created.
161
+ Typically from unit coordinates in the handler box to screen
162
+ coordinates.
163
+ """
164
+ raise NotImplementedError('Derived must override')
165
+
166
+
167
+ class HandlerNpoints(HandlerBase):
168
+ """
169
+ A legend handler that shows *numpoints* points in the legend entry.
170
+ """
171
+
172
+ def __init__(self, marker_pad=0.3, numpoints=None, **kwargs):
173
+ """
174
+ Parameters
175
+ ----------
176
+ marker_pad : float
177
+ Padding between points in legend entry.
178
+ numpoints : int
179
+ Number of points to show in legend entry.
180
+ **kwargs
181
+ Keyword arguments forwarded to `.HandlerBase`.
182
+ """
183
+ super().__init__(**kwargs)
184
+
185
+ self._numpoints = numpoints
186
+ self._marker_pad = marker_pad
187
+
188
+ def get_numpoints(self, legend):
189
+ if self._numpoints is None:
190
+ return legend.numpoints
191
+ else:
192
+ return self._numpoints
193
+
194
+ def get_xdata(self, legend, xdescent, ydescent, width, height, fontsize):
195
+ numpoints = self.get_numpoints(legend)
196
+ if numpoints > 1:
197
+ # we put some pad here to compensate the size of the marker
198
+ pad = self._marker_pad * fontsize
199
+ xdata = np.linspace(-xdescent + pad,
200
+ -xdescent + width - pad,
201
+ numpoints)
202
+ xdata_marker = xdata
203
+ else:
204
+ xdata = [-xdescent, -xdescent + width]
205
+ xdata_marker = [-xdescent + 0.5 * width]
206
+ return xdata, xdata_marker
207
+
208
+
209
+ class HandlerNpointsYoffsets(HandlerNpoints):
210
+ """
211
+ A legend handler that shows *numpoints* in the legend, and allows them to
212
+ be individually offset in the y-direction.
213
+ """
214
+
215
+ def __init__(self, numpoints=None, yoffsets=None, **kwargs):
216
+ """
217
+ Parameters
218
+ ----------
219
+ numpoints : int
220
+ Number of points to show in legend entry.
221
+ yoffsets : array of floats
222
+ Length *numpoints* list of y offsets for each point in
223
+ legend entry.
224
+ **kwargs
225
+ Keyword arguments forwarded to `.HandlerNpoints`.
226
+ """
227
+ super().__init__(numpoints=numpoints, **kwargs)
228
+ self._yoffsets = yoffsets
229
+
230
+ def get_ydata(self, legend, xdescent, ydescent, width, height, fontsize):
231
+ if self._yoffsets is None:
232
+ ydata = height * legend._scatteryoffsets
233
+ else:
234
+ ydata = height * np.asarray(self._yoffsets)
235
+
236
+ return ydata
237
+
238
+
239
+ class HandlerLine2DCompound(HandlerNpoints):
240
+ """
241
+ Original handler for `.Line2D` instances, that relies on combining
242
+ a line-only with a marker-only artist. May be deprecated in the future.
243
+ """
244
+
245
+ def create_artists(self, legend, orig_handle,
246
+ xdescent, ydescent, width, height, fontsize,
247
+ trans):
248
+ # docstring inherited
249
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
250
+ width, height, fontsize)
251
+
252
+ ydata = np.full_like(xdata, ((height - ydescent) / 2))
253
+ legline = Line2D(xdata, ydata)
254
+
255
+ self.update_prop(legline, orig_handle, legend)
256
+ legline.set_drawstyle('default')
257
+ legline.set_marker("")
258
+
259
+ legline_marker = Line2D(xdata_marker, ydata[:len(xdata_marker)])
260
+ self.update_prop(legline_marker, orig_handle, legend)
261
+ legline_marker.set_linestyle('None')
262
+ if legend.markerscale != 1:
263
+ newsz = legline_marker.get_markersize() * legend.markerscale
264
+ legline_marker.set_markersize(newsz)
265
+ # we don't want to add this to the return list because
266
+ # the texts and handles are assumed to be in one-to-one
267
+ # correspondence.
268
+ legline._legmarker = legline_marker
269
+
270
+ legline.set_transform(trans)
271
+ legline_marker.set_transform(trans)
272
+
273
+ return [legline, legline_marker]
274
+
275
+
276
+ class HandlerLine2D(HandlerNpoints):
277
+ """
278
+ Handler for `.Line2D` instances.
279
+
280
+ See Also
281
+ --------
282
+ HandlerLine2DCompound : An earlier handler implementation, which used one
283
+ artist for the line and another for the marker(s).
284
+ """
285
+
286
+ def create_artists(self, legend, orig_handle,
287
+ xdescent, ydescent, width, height, fontsize,
288
+ trans):
289
+ # docstring inherited
290
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
291
+ width, height, fontsize)
292
+
293
+ markevery = None
294
+ if self.get_numpoints(legend) == 1:
295
+ # Special case: one wants a single marker in the center
296
+ # and a line that extends on both sides. One will use a
297
+ # 3 points line, but only mark the #1 (i.e. middle) point.
298
+ xdata = np.linspace(xdata[0], xdata[-1], 3)
299
+ markevery = [1]
300
+
301
+ ydata = np.full_like(xdata, (height - ydescent) / 2)
302
+ legline = Line2D(xdata, ydata, markevery=markevery)
303
+
304
+ self.update_prop(legline, orig_handle, legend)
305
+
306
+ if legend.markerscale != 1:
307
+ newsz = legline.get_markersize() * legend.markerscale
308
+ legline.set_markersize(newsz)
309
+
310
+ legline.set_transform(trans)
311
+
312
+ return [legline]
313
+
314
+
315
+ class HandlerPatch(HandlerBase):
316
+ """
317
+ Handler for `.Patch` instances.
318
+ """
319
+
320
+ def __init__(self, patch_func=None, **kwargs):
321
+ """
322
+ Parameters
323
+ ----------
324
+ patch_func : callable, optional
325
+ The function that creates the legend key artist.
326
+ *patch_func* should have the signature::
327
+
328
+ def patch_func(legend=legend, orig_handle=orig_handle,
329
+ xdescent=xdescent, ydescent=ydescent,
330
+ width=width, height=height, fontsize=fontsize)
331
+
332
+ Subsequently, the created artist will have its ``update_prop``
333
+ method called and the appropriate transform will be applied.
334
+
335
+ **kwargs
336
+ Keyword arguments forwarded to `.HandlerBase`.
337
+ """
338
+ super().__init__(**kwargs)
339
+ self._patch_func = patch_func
340
+
341
+ def _create_patch(self, legend, orig_handle,
342
+ xdescent, ydescent, width, height, fontsize):
343
+ if self._patch_func is None:
344
+ p = Rectangle(xy=(-xdescent, -ydescent),
345
+ width=width, height=height)
346
+ else:
347
+ p = self._patch_func(legend=legend, orig_handle=orig_handle,
348
+ xdescent=xdescent, ydescent=ydescent,
349
+ width=width, height=height, fontsize=fontsize)
350
+ return p
351
+
352
+ def create_artists(self, legend, orig_handle,
353
+ xdescent, ydescent, width, height, fontsize, trans):
354
+ # docstring inherited
355
+ p = self._create_patch(legend, orig_handle,
356
+ xdescent, ydescent, width, height, fontsize)
357
+ self.update_prop(p, orig_handle, legend)
358
+ p.set_transform(trans)
359
+ return [p]
360
+
361
+
362
+ class HandlerStepPatch(HandlerBase):
363
+ """
364
+ Handler for `~.matplotlib.patches.StepPatch` instances.
365
+ """
366
+
367
+ @staticmethod
368
+ def _create_patch(orig_handle, xdescent, ydescent, width, height):
369
+ return Rectangle(xy=(-xdescent, -ydescent), width=width,
370
+ height=height, color=orig_handle.get_facecolor())
371
+
372
+ @staticmethod
373
+ def _create_line(orig_handle, width, height):
374
+ # Unfilled StepPatch should show as a line
375
+ legline = Line2D([0, width], [height/2, height/2],
376
+ color=orig_handle.get_edgecolor(),
377
+ linestyle=orig_handle.get_linestyle(),
378
+ linewidth=orig_handle.get_linewidth(),
379
+ )
380
+
381
+ # Overwrite manually because patch and line properties don't mix
382
+ legline.set_drawstyle('default')
383
+ legline.set_marker("")
384
+ return legline
385
+
386
+ def create_artists(self, legend, orig_handle,
387
+ xdescent, ydescent, width, height, fontsize, trans):
388
+ # docstring inherited
389
+ if orig_handle.get_fill() or (orig_handle.get_hatch() is not None):
390
+ p = self._create_patch(orig_handle, xdescent, ydescent, width,
391
+ height)
392
+ self.update_prop(p, orig_handle, legend)
393
+ else:
394
+ p = self._create_line(orig_handle, width, height)
395
+ p.set_transform(trans)
396
+ return [p]
397
+
398
+
399
+ class HandlerLineCollection(HandlerLine2D):
400
+ """
401
+ Handler for `.LineCollection` instances.
402
+ """
403
+ def get_numpoints(self, legend):
404
+ if self._numpoints is None:
405
+ return legend.scatterpoints
406
+ else:
407
+ return self._numpoints
408
+
409
+ def _default_update_prop(self, legend_handle, orig_handle):
410
+ lw = orig_handle.get_linewidths()[0]
411
+ dashes = orig_handle._us_linestyles[0]
412
+ color = orig_handle.get_colors()[0]
413
+ legend_handle.set_color(color)
414
+ legend_handle.set_linestyle(dashes)
415
+ legend_handle.set_linewidth(lw)
416
+
417
+ def create_artists(self, legend, orig_handle,
418
+ xdescent, ydescent, width, height, fontsize, trans):
419
+ # docstring inherited
420
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
421
+ width, height, fontsize)
422
+ ydata = np.full_like(xdata, (height - ydescent) / 2)
423
+ legline = Line2D(xdata, ydata)
424
+
425
+ self.update_prop(legline, orig_handle, legend)
426
+ legline.set_transform(trans)
427
+
428
+ return [legline]
429
+
430
+
431
+ class HandlerRegularPolyCollection(HandlerNpointsYoffsets):
432
+ r"""Handler for `.RegularPolyCollection`\s."""
433
+
434
+ def __init__(self, yoffsets=None, sizes=None, **kwargs):
435
+ super().__init__(yoffsets=yoffsets, **kwargs)
436
+
437
+ self._sizes = sizes
438
+
439
+ def get_numpoints(self, legend):
440
+ if self._numpoints is None:
441
+ return legend.scatterpoints
442
+ else:
443
+ return self._numpoints
444
+
445
+ def get_sizes(self, legend, orig_handle,
446
+ xdescent, ydescent, width, height, fontsize):
447
+ if self._sizes is None:
448
+ handle_sizes = orig_handle.get_sizes()
449
+ if not len(handle_sizes):
450
+ handle_sizes = [1]
451
+ size_max = max(handle_sizes) * legend.markerscale ** 2
452
+ size_min = min(handle_sizes) * legend.markerscale ** 2
453
+
454
+ numpoints = self.get_numpoints(legend)
455
+ if numpoints < 4:
456
+ sizes = [.5 * (size_max + size_min), size_max,
457
+ size_min][:numpoints]
458
+ else:
459
+ rng = (size_max - size_min)
460
+ sizes = rng * np.linspace(0, 1, numpoints) + size_min
461
+ else:
462
+ sizes = self._sizes
463
+
464
+ return sizes
465
+
466
+ def update_prop(self, legend_handle, orig_handle, legend):
467
+
468
+ self._update_prop(legend_handle, orig_handle)
469
+
470
+ legend_handle.set_figure(legend.get_figure(root=False))
471
+ # legend._set_artist_props(legend_handle)
472
+ legend_handle.set_clip_box(None)
473
+ legend_handle.set_clip_path(None)
474
+
475
+ def create_collection(self, orig_handle, sizes, offsets, offset_transform):
476
+ return type(orig_handle)(
477
+ orig_handle.get_numsides(),
478
+ rotation=orig_handle.get_rotation(), sizes=sizes,
479
+ offsets=offsets, offset_transform=offset_transform,
480
+ )
481
+
482
+ def create_artists(self, legend, orig_handle,
483
+ xdescent, ydescent, width, height, fontsize,
484
+ trans):
485
+ # docstring inherited
486
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
487
+ width, height, fontsize)
488
+
489
+ ydata = self.get_ydata(legend, xdescent, ydescent,
490
+ width, height, fontsize)
491
+
492
+ sizes = self.get_sizes(legend, orig_handle, xdescent, ydescent,
493
+ width, height, fontsize)
494
+
495
+ p = self.create_collection(
496
+ orig_handle, sizes,
497
+ offsets=list(zip(xdata_marker, ydata)), offset_transform=trans)
498
+
499
+ self.update_prop(p, orig_handle, legend)
500
+ p.set_offset_transform(trans)
501
+ return [p]
502
+
503
+
504
+ class HandlerPathCollection(HandlerRegularPolyCollection):
505
+ r"""Handler for `.PathCollection`\s, which are used by `~.Axes.scatter`."""
506
+
507
+ def create_collection(self, orig_handle, sizes, offsets, offset_transform):
508
+ return type(orig_handle)(
509
+ [orig_handle.get_paths()[0]], sizes=sizes,
510
+ offsets=offsets, offset_transform=offset_transform,
511
+ )
512
+
513
+
514
+ class HandlerCircleCollection(HandlerRegularPolyCollection):
515
+ r"""Handler for `.CircleCollection`\s."""
516
+
517
+ def create_collection(self, orig_handle, sizes, offsets, offset_transform):
518
+ return type(orig_handle)(
519
+ sizes, offsets=offsets, offset_transform=offset_transform)
520
+
521
+
522
+ class HandlerErrorbar(HandlerLine2D):
523
+ """Handler for Errorbars."""
524
+
525
+ def __init__(self, xerr_size=0.5, yerr_size=None,
526
+ marker_pad=0.3, numpoints=None, **kwargs):
527
+
528
+ self._xerr_size = xerr_size
529
+ self._yerr_size = yerr_size
530
+
531
+ super().__init__(marker_pad=marker_pad, numpoints=numpoints, **kwargs)
532
+
533
+ def get_err_size(self, legend, xdescent, ydescent,
534
+ width, height, fontsize):
535
+ xerr_size = self._xerr_size * fontsize
536
+
537
+ if self._yerr_size is None:
538
+ yerr_size = xerr_size
539
+ else:
540
+ yerr_size = self._yerr_size * fontsize
541
+
542
+ return xerr_size, yerr_size
543
+
544
+ def create_artists(self, legend, orig_handle,
545
+ xdescent, ydescent, width, height, fontsize,
546
+ trans):
547
+ # docstring inherited
548
+ plotlines, caplines, barlinecols = orig_handle
549
+
550
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
551
+ width, height, fontsize)
552
+
553
+ ydata = np.full_like(xdata, (height - ydescent) / 2)
554
+ legline = Line2D(xdata, ydata)
555
+
556
+ xdata_marker = np.asarray(xdata_marker)
557
+ ydata_marker = np.asarray(ydata[:len(xdata_marker)])
558
+
559
+ xerr_size, yerr_size = self.get_err_size(legend, xdescent, ydescent,
560
+ width, height, fontsize)
561
+
562
+ legline_marker = Line2D(xdata_marker, ydata_marker)
563
+
564
+ # when plotlines are None (only errorbars are drawn), we just
565
+ # make legline invisible.
566
+ if plotlines is None:
567
+ legline.set_visible(False)
568
+ legline_marker.set_visible(False)
569
+ else:
570
+ self.update_prop(legline, plotlines, legend)
571
+
572
+ legline.set_drawstyle('default')
573
+ legline.set_marker('none')
574
+
575
+ self.update_prop(legline_marker, plotlines, legend)
576
+ legline_marker.set_linestyle('None')
577
+
578
+ if legend.markerscale != 1:
579
+ newsz = legline_marker.get_markersize() * legend.markerscale
580
+ legline_marker.set_markersize(newsz)
581
+
582
+ handle_barlinecols = []
583
+ handle_caplines = []
584
+
585
+ if orig_handle.has_xerr:
586
+ verts = [((x - xerr_size, y), (x + xerr_size, y))
587
+ for x, y in zip(xdata_marker, ydata_marker)]
588
+ coll = mcoll.LineCollection(verts)
589
+ self.update_prop(coll, barlinecols[0], legend)
590
+ handle_barlinecols.append(coll)
591
+
592
+ if caplines:
593
+ capline_left = Line2D(xdata_marker - xerr_size, ydata_marker)
594
+ capline_right = Line2D(xdata_marker + xerr_size, ydata_marker)
595
+ self.update_prop(capline_left, caplines[0], legend)
596
+ self.update_prop(capline_right, caplines[0], legend)
597
+ capline_left.set_marker("|")
598
+ capline_right.set_marker("|")
599
+
600
+ handle_caplines.append(capline_left)
601
+ handle_caplines.append(capline_right)
602
+
603
+ if orig_handle.has_yerr:
604
+ verts = [((x, y - yerr_size), (x, y + yerr_size))
605
+ for x, y in zip(xdata_marker, ydata_marker)]
606
+ coll = mcoll.LineCollection(verts)
607
+ self.update_prop(coll, barlinecols[0], legend)
608
+ handle_barlinecols.append(coll)
609
+
610
+ if caplines:
611
+ capline_left = Line2D(xdata_marker, ydata_marker - yerr_size)
612
+ capline_right = Line2D(xdata_marker, ydata_marker + yerr_size)
613
+ self.update_prop(capline_left, caplines[0], legend)
614
+ self.update_prop(capline_right, caplines[0], legend)
615
+ capline_left.set_marker("_")
616
+ capline_right.set_marker("_")
617
+
618
+ handle_caplines.append(capline_left)
619
+ handle_caplines.append(capline_right)
620
+
621
+ artists = [
622
+ *handle_barlinecols, *handle_caplines, legline, legline_marker,
623
+ ]
624
+ for artist in artists:
625
+ artist.set_transform(trans)
626
+ return artists
627
+
628
+
629
+ class HandlerStem(HandlerNpointsYoffsets):
630
+ """
631
+ Handler for plots produced by `~.Axes.stem`.
632
+ """
633
+
634
+ def __init__(self, marker_pad=0.3, numpoints=None,
635
+ bottom=None, yoffsets=None, **kwargs):
636
+ """
637
+ Parameters
638
+ ----------
639
+ marker_pad : float, default: 0.3
640
+ Padding between points in legend entry.
641
+ numpoints : int, optional
642
+ Number of points to show in legend entry.
643
+ bottom : float, optional
644
+
645
+ yoffsets : array of floats, optional
646
+ Length *numpoints* list of y offsets for each point in
647
+ legend entry.
648
+ **kwargs
649
+ Keyword arguments forwarded to `.HandlerNpointsYoffsets`.
650
+ """
651
+ super().__init__(marker_pad=marker_pad, numpoints=numpoints,
652
+ yoffsets=yoffsets, **kwargs)
653
+ self._bottom = bottom
654
+
655
+ def get_ydata(self, legend, xdescent, ydescent, width, height, fontsize):
656
+ if self._yoffsets is None:
657
+ ydata = height * (0.5 * legend._scatteryoffsets + 0.5)
658
+ else:
659
+ ydata = height * np.asarray(self._yoffsets)
660
+
661
+ return ydata
662
+
663
+ def create_artists(self, legend, orig_handle,
664
+ xdescent, ydescent, width, height, fontsize,
665
+ trans):
666
+ # docstring inherited
667
+ markerline, stemlines, baseline = orig_handle
668
+ # Check to see if the stemcontainer is storing lines as a list or a
669
+ # LineCollection. Eventually using a list will be removed, and this
670
+ # logic can also be removed.
671
+ using_linecoll = isinstance(stemlines, mcoll.LineCollection)
672
+
673
+ xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
674
+ width, height, fontsize)
675
+
676
+ ydata = self.get_ydata(legend, xdescent, ydescent,
677
+ width, height, fontsize)
678
+
679
+ if self._bottom is None:
680
+ bottom = 0.
681
+ else:
682
+ bottom = self._bottom
683
+
684
+ leg_markerline = Line2D(xdata_marker, ydata[:len(xdata_marker)])
685
+ self.update_prop(leg_markerline, markerline, legend)
686
+
687
+ leg_stemlines = [Line2D([x, x], [bottom, y])
688
+ for x, y in zip(xdata_marker, ydata)]
689
+
690
+ if using_linecoll:
691
+ # change the function used by update_prop() from the default
692
+ # to one that handles LineCollection
693
+ with cbook._setattr_cm(
694
+ self, _update_prop_func=self._copy_collection_props):
695
+ for line in leg_stemlines:
696
+ self.update_prop(line, stemlines, legend)
697
+
698
+ else:
699
+ for lm, m in zip(leg_stemlines, stemlines):
700
+ self.update_prop(lm, m, legend)
701
+
702
+ leg_baseline = Line2D([np.min(xdata), np.max(xdata)],
703
+ [bottom, bottom])
704
+ self.update_prop(leg_baseline, baseline, legend)
705
+
706
+ artists = [*leg_stemlines, leg_baseline, leg_markerline]
707
+ for artist in artists:
708
+ artist.set_transform(trans)
709
+ return artists
710
+
711
+ def _copy_collection_props(self, legend_handle, orig_handle):
712
+ """
713
+ Copy properties from the `.LineCollection` *orig_handle* to the
714
+ `.Line2D` *legend_handle*.
715
+ """
716
+ legend_handle.set_color(orig_handle.get_color()[0])
717
+ legend_handle.set_linestyle(orig_handle.get_linestyle()[0])
718
+
719
+
720
+ class HandlerTuple(HandlerBase):
721
+ """
722
+ Handler for Tuple.
723
+ """
724
+
725
+ def __init__(self, ndivide=1, pad=None, **kwargs):
726
+ """
727
+ Parameters
728
+ ----------
729
+ ndivide : int or None, default: 1
730
+ The number of sections to divide the legend area into. If None,
731
+ use the length of the input tuple.
732
+ pad : float, default: :rc:`legend.borderpad`
733
+ Padding in units of fraction of font size.
734
+ **kwargs
735
+ Keyword arguments forwarded to `.HandlerBase`.
736
+ """
737
+ self._ndivide = ndivide
738
+ self._pad = pad
739
+ super().__init__(**kwargs)
740
+
741
+ def create_artists(self, legend, orig_handle,
742
+ xdescent, ydescent, width, height, fontsize,
743
+ trans):
744
+ # docstring inherited
745
+ handler_map = legend.get_legend_handler_map()
746
+
747
+ if self._ndivide is None:
748
+ ndivide = len(orig_handle)
749
+ else:
750
+ ndivide = self._ndivide
751
+
752
+ if self._pad is None:
753
+ pad = legend.borderpad * fontsize
754
+ else:
755
+ pad = self._pad * fontsize
756
+
757
+ if ndivide > 1:
758
+ width = (width - pad * (ndivide - 1)) / ndivide
759
+
760
+ xds_cycle = cycle(xdescent - (width + pad) * np.arange(ndivide))
761
+
762
+ a_list = []
763
+ for handle1 in orig_handle:
764
+ handler = legend.get_legend_handler(handler_map, handle1)
765
+ _a_list = handler.create_artists(
766
+ legend, handle1,
767
+ next(xds_cycle), ydescent, width, height, fontsize, trans)
768
+ a_list.extend(_a_list)
769
+
770
+ return a_list
771
+
772
+
773
+ class HandlerPolyCollection(HandlerBase):
774
+ """
775
+ Handler for `.PolyCollection` used in `~.Axes.fill_between` and
776
+ `~.Axes.stackplot`.
777
+ """
778
+ def _update_prop(self, legend_handle, orig_handle):
779
+ def first_color(colors):
780
+ if colors.size == 0:
781
+ return (0, 0, 0, 0)
782
+ return tuple(colors[0])
783
+
784
+ def get_first(prop_array):
785
+ if len(prop_array):
786
+ return prop_array[0]
787
+ else:
788
+ return None
789
+
790
+ # orig_handle is a PolyCollection and legend_handle is a Patch.
791
+ # Directly set Patch color attributes (must be RGBA tuples).
792
+ legend_handle._facecolor = first_color(orig_handle.get_facecolor())
793
+ legend_handle._edgecolor = first_color(orig_handle.get_edgecolor())
794
+ legend_handle._hatch_color = first_color(orig_handle.get_hatchcolor())
795
+ legend_handle._original_facecolor = orig_handle._original_facecolor
796
+ legend_handle._original_edgecolor = orig_handle._original_edgecolor
797
+ legend_handle._fill = orig_handle.get_fill()
798
+ legend_handle._hatch = orig_handle.get_hatch()
799
+ # Setters are fine for the remaining attributes.
800
+ legend_handle.set_linewidth(get_first(orig_handle.get_linewidths()))
801
+ legend_handle.set_linestyle(get_first(orig_handle.get_linestyles()))
802
+ legend_handle.set_transform(get_first(orig_handle.get_transforms()))
803
+ # Alpha is already taken into account by the color attributes.
804
+
805
+ def create_artists(self, legend, orig_handle,
806
+ xdescent, ydescent, width, height, fontsize, trans):
807
+ # docstring inherited
808
+ p = Rectangle(xy=(-xdescent, -ydescent),
809
+ width=width, height=height)
810
+ self.update_prop(p, orig_handle, legend)
811
+ p.set_transform(trans)
812
+ return [p]