matplotlib-rs 0.0.8__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. docs/releases/0.0.1.md +268 -0
  2. docs/releases/0.0.2.md +69 -0
  3. docs/releases/0.0.3.md +80 -0
  4. docs/releases/0.0.4.md +73 -0
  5. docs/releases/0.0.5.md +24 -0
  6. docs/releases/0.0.6.md +24 -0
  7. docs/releases/0.0.7.md +24 -0
  8. docs/releases/0.0.8.md +16 -0
  9. licenses/LICENSE_CONTOURPY +29 -0
  10. licenses/LICENSE_CYCLER +27 -0
  11. licenses/LICENSE_DATEUTIL +54 -0
  12. licenses/LICENSE_KIWISOLVER +71 -0
  13. licenses/LICENSE_LIBWEBP +56 -0
  14. licenses/LICENSE_MATPLOTLIB +1253 -0
  15. licenses/LICENSE_PYPARSING +20 -0
  16. licenses/LICENSE_QHULL +39 -0
  17. licenses/LICENSE_SIX +18 -0
  18. matplotlib_rs/__init__.py +1683 -0
  19. matplotlib_rs/__main__.py +27 -0
  20. matplotlib_rs/_afm.py +500 -0
  21. matplotlib_rs/_animation_data.py +263 -0
  22. matplotlib_rs/_api/__init__.py +495 -0
  23. matplotlib_rs/_api/deprecation.py +534 -0
  24. matplotlib_rs/_axis_py.py +2991 -0
  25. matplotlib_rs/_blocking_input.py +31 -0
  26. matplotlib_rs/_cm.py +1500 -0
  27. matplotlib_rs/_cm_bivar.py +1289 -0
  28. matplotlib_rs/_cm_listed.py +2848 -0
  29. matplotlib_rs/_cm_multivar.py +167 -0
  30. matplotlib_rs/_color_data.py +1142 -0
  31. matplotlib_rs/_colormap.py +132 -0
  32. matplotlib_rs/_constrained_layout.py +825 -0
  33. matplotlib_rs/_contour.py +108 -0
  34. matplotlib_rs/_doc_cache.py +12214 -0
  35. matplotlib_rs/_docstring.py +142 -0
  36. matplotlib_rs/_enums.py +178 -0
  37. matplotlib_rs/_figure_rs.py +294 -0
  38. matplotlib_rs/_fontconfig_pattern.py +129 -0
  39. matplotlib_rs/_foreign.py +220 -0
  40. matplotlib_rs/_hook.py +94 -0
  41. matplotlib_rs/_image.py +160 -0
  42. matplotlib_rs/_imageio.py +229 -0
  43. matplotlib_rs/_internal_utils.py +65 -0
  44. matplotlib_rs/_kiwi.py +484 -0
  45. matplotlib_rs/_layoutgrid.py +549 -0
  46. matplotlib_rs/_live.py +192 -0
  47. matplotlib_rs/_mathtext.py +3103 -0
  48. matplotlib_rs/_mathtext_data.py +1811 -0
  49. matplotlib_rs/_mplrs.cp315-win_amd64.pyd +0 -0
  50. matplotlib_rs/_path.py +25 -0
  51. matplotlib_rs/_png.py +162 -0
  52. matplotlib_rs/_pylab_helpers.py +137 -0
  53. matplotlib_rs/_qhull.py +66 -0
  54. matplotlib_rs/_rcpush.py +84 -0
  55. matplotlib_rs/_spines_rs.py +108 -0
  56. matplotlib_rs/_style_helpers.py +52 -0
  57. matplotlib_rs/_text_helpers.py +51 -0
  58. matplotlib_rs/_tight_bbox.py +85 -0
  59. matplotlib_rs/_tight_layout.py +302 -0
  60. matplotlib_rs/_tri.py +140 -0
  61. matplotlib_rs/_type1font.py +1228 -0
  62. matplotlib_rs/_vendor/__init__.py +8 -0
  63. matplotlib_rs/_vendor/cycler.py +574 -0
  64. matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
  65. matplotlib_rs/_vendor/dateutil/_common.py +44 -0
  66. matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
  67. matplotlib_rs/_vendor/dateutil/_version.py +5 -0
  68. matplotlib_rs/_vendor/dateutil/easter.py +90 -0
  69. matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
  70. matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
  71. matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
  72. matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
  73. matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
  74. matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
  75. matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
  76. matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
  77. matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
  78. matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
  79. matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
  80. matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
  81. matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
  82. matplotlib_rs/_vendor/dateutil/utils.py +72 -0
  83. matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
  84. matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
  85. matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
  86. matplotlib_rs/_vendor/pyparsing/common.py +571 -0
  87. matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
  88. matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
  89. matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
  90. matplotlib_rs/_vendor/pyparsing/results.py +929 -0
  91. matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
  92. matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
  93. matplotlib_rs/_vendor/pyparsing/util.py +515 -0
  94. matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
  95. matplotlib_rs/_vendor/six.py +1004 -0
  96. matplotlib_rs/animation.py +1843 -0
  97. matplotlib_rs/artist.py +2302 -0
  98. matplotlib_rs/axes/__init__.py +19 -0
  99. matplotlib_rs/axes/_axes.py +9402 -0
  100. matplotlib_rs/axes/_bar.py +185 -0
  101. matplotlib_rs/axes/_base.py +5236 -0
  102. matplotlib_rs/axes/_base_rs.py +727 -0
  103. matplotlib_rs/axes/_boxplot.py +391 -0
  104. matplotlib_rs/axes/_hist.py +99 -0
  105. matplotlib_rs/axes/_secondary_axes.py +357 -0
  106. matplotlib_rs/axis.py +1963 -0
  107. matplotlib_rs/backend_bases.py +3760 -0
  108. matplotlib_rs/backend_managers.py +388 -0
  109. matplotlib_rs/backend_tools.py +1002 -0
  110. matplotlib_rs/backends/__init__.py +6 -0
  111. matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
  112. matplotlib_rs/backends/backend_agg.py +552 -0
  113. matplotlib_rs/backends/backend_mixed.py +123 -0
  114. matplotlib_rs/backends/backend_pdf.py +2711 -0
  115. matplotlib_rs/backends/backend_pgf.py +1031 -0
  116. matplotlib_rs/backends/backend_ps.py +1491 -0
  117. matplotlib_rs/backends/backend_svg.py +1395 -0
  118. matplotlib_rs/backends/backend_template.py +214 -0
  119. matplotlib_rs/backends/registry.py +423 -0
  120. matplotlib_rs/bezier.py +691 -0
  121. matplotlib_rs/category.py +236 -0
  122. matplotlib_rs/cbook.py +2762 -0
  123. matplotlib_rs/cm.py +251 -0
  124. matplotlib_rs/collections.py +2711 -0
  125. matplotlib_rs/colorbar.py +1586 -0
  126. matplotlib_rs/colorizer.py +909 -0
  127. matplotlib_rs/colors.py +4278 -0
  128. matplotlib_rs/container.py +256 -0
  129. matplotlib_rs/contour.py +1756 -0
  130. matplotlib_rs/dates.py +1847 -0
  131. matplotlib_rs/dviread.py +1386 -0
  132. matplotlib_rs/figure.py +3815 -0
  133. matplotlib_rs/font_manager.py +1855 -0
  134. matplotlib_rs/ft2font.py +515 -0
  135. matplotlib_rs/gridspec.py +808 -0
  136. matplotlib_rs/hatch.py +244 -0
  137. matplotlib_rs/image.py +1863 -0
  138. matplotlib_rs/inset.py +291 -0
  139. matplotlib_rs/layout_engine.py +310 -0
  140. matplotlib_rs/legend.py +1480 -0
  141. matplotlib_rs/legend_handler.py +812 -0
  142. matplotlib_rs/lines.py +1886 -0
  143. matplotlib_rs/markers.py +908 -0
  144. matplotlib_rs/mathtext.py +141 -0
  145. matplotlib_rs/mlab.py +959 -0
  146. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
  147. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
  148. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
  149. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
  150. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
  151. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
  152. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
  153. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
  154. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
  155. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
  156. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
  157. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
  158. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
  159. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
  160. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
  161. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
  162. matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
  163. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
  164. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
  165. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
  166. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
  167. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
  168. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
  169. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
  170. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
  171. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
  172. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
  173. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
  174. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
  175. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
  176. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
  177. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
  178. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
  179. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
  180. matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
  181. matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
  182. matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
  183. matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
  184. matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
  185. matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
  186. matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
  187. matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
  188. matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
  189. matplotlib_rs/mpl-data/images/back.pdf +0 -0
  190. matplotlib_rs/mpl-data/images/back.png +0 -0
  191. matplotlib_rs/mpl-data/images/back.svg +46 -0
  192. matplotlib_rs/mpl-data/images/back_large.png +0 -0
  193. matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
  194. matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
  195. matplotlib_rs/mpl-data/images/filesave.png +0 -0
  196. matplotlib_rs/mpl-data/images/filesave.svg +68 -0
  197. matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
  198. matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
  199. matplotlib_rs/mpl-data/images/forward.pdf +0 -0
  200. matplotlib_rs/mpl-data/images/forward.png +0 -0
  201. matplotlib_rs/mpl-data/images/forward.svg +46 -0
  202. matplotlib_rs/mpl-data/images/forward_large.png +0 -0
  203. matplotlib_rs/mpl-data/images/hand.pdf +0 -0
  204. matplotlib_rs/mpl-data/images/hand.png +0 -0
  205. matplotlib_rs/mpl-data/images/hand.svg +130 -0
  206. matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
  207. matplotlib_rs/mpl-data/images/help.pdf +71 -0
  208. matplotlib_rs/mpl-data/images/help.png +0 -0
  209. matplotlib_rs/mpl-data/images/help.svg +52 -0
  210. matplotlib_rs/mpl-data/images/help_large.png +0 -0
  211. matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
  212. matplotlib_rs/mpl-data/images/home.pdf +0 -0
  213. matplotlib_rs/mpl-data/images/home.png +0 -0
  214. matplotlib_rs/mpl-data/images/home.svg +59 -0
  215. matplotlib_rs/mpl-data/images/home_large.png +0 -0
  216. matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
  217. matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
  218. matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
  219. matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
  220. matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
  221. matplotlib_rs/mpl-data/images/move.pdf +0 -0
  222. matplotlib_rs/mpl-data/images/move.png +0 -0
  223. matplotlib_rs/mpl-data/images/move.svg +73 -0
  224. matplotlib_rs/mpl-data/images/move_large.png +0 -0
  225. matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
  226. matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
  227. matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
  228. matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
  229. matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
  230. matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
  231. matplotlib_rs/mpl-data/images/subplots.png +0 -0
  232. matplotlib_rs/mpl-data/images/subplots.svg +81 -0
  233. matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
  234. matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
  235. matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
  236. matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
  237. matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
  238. matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
  239. matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
  240. matplotlib_rs/mpl-data/matplotlibrc +849 -0
  241. matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
  242. matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
  243. matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
  244. matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
  245. matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
  246. matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
  247. matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
  248. matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
  249. matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
  250. matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
  251. matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
  252. matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
  253. matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
  254. matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
  255. matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
  256. matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
  257. matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
  258. matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
  259. matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
  260. matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
  261. matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
  262. matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
  263. matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
  264. matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
  265. matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
  266. matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
  267. matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
  268. matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
  269. matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
  270. matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
  271. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
  272. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
  273. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
  274. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
  275. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
  276. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
  277. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
  278. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
  279. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
  280. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
  281. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
  282. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
  283. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
  284. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
  285. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
  286. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
  287. matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
  288. matplotlib_rs/mpl_toolkits/__init__.py +3 -0
  289. matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
  290. matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
  291. matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
  292. matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
  293. matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
  294. matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
  295. matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
  296. matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
  297. matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
  298. matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
  299. matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
  300. matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
  301. matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
  302. matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
  303. matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
  304. matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
  305. matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
  306. matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
  307. matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
  308. matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
  309. matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
  310. matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
  311. matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
  312. matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
  313. matplotlib_rs/offsetbox.py +1726 -0
  314. matplotlib_rs/patches.py +5049 -0
  315. matplotlib_rs/path.py +1147 -0
  316. matplotlib_rs/patheffects.py +512 -0
  317. matplotlib_rs/projections/__init__.py +126 -0
  318. matplotlib_rs/projections/geo.py +512 -0
  319. matplotlib_rs/projections/polar.py +1518 -0
  320. matplotlib_rs/pylab.py +68 -0
  321. matplotlib_rs/pyplot.py +4834 -0
  322. matplotlib_rs/quiver.py +1236 -0
  323. matplotlib_rs/rcsetup.py +3435 -0
  324. matplotlib_rs/sankey.py +815 -0
  325. matplotlib_rs/scale.py +1002 -0
  326. matplotlib_rs/spines.py +618 -0
  327. matplotlib_rs/stackplot.py +144 -0
  328. matplotlib_rs/streamplot.py +768 -0
  329. matplotlib_rs/style/__init__.py +269 -0
  330. matplotlib_rs/style/core.py +28 -0
  331. matplotlib_rs/table.py +860 -0
  332. matplotlib_rs/texmanager.py +375 -0
  333. matplotlib_rs/text.py +2412 -0
  334. matplotlib_rs/textpath.py +377 -0
  335. matplotlib_rs/ticker.py +3111 -0
  336. matplotlib_rs/transforms.py +3069 -0
  337. matplotlib_rs/tri/__init__.py +24 -0
  338. matplotlib_rs/tri/_triangulation.py +248 -0
  339. matplotlib_rs/tri/_tricontour.py +271 -0
  340. matplotlib_rs/tri/_trifinder.py +97 -0
  341. matplotlib_rs/tri/_triinterpolate.py +1575 -0
  342. matplotlib_rs/tri/_tripcolor.py +170 -0
  343. matplotlib_rs/tri/_triplot.py +87 -0
  344. matplotlib_rs/tri/_trirefine.py +308 -0
  345. matplotlib_rs/tri/_tritools.py +264 -0
  346. matplotlib_rs/typing.py +597 -0
  347. matplotlib_rs/units.py +196 -0
  348. matplotlib_rs/widgets.py +4455 -0
  349. matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
  350. matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
  351. matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
  352. matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
@@ -0,0 +1,825 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ Adjust subplot layouts so that there are no overlapping Axes or Axes
4
+ decorations. All Axes decorations are dealt with (labels, ticks, titles,
5
+ ticklabels) and some dependent artists are also dealt with (colorbar,
6
+ suptitle).
7
+
8
+ Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
9
+ so it is possible to have overlapping Axes if the gridspecs overlap (i.e.
10
+ using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using
11
+ ``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
12
+ layout. Axes manually placed via ``figure.add_axes()`` will not.
13
+
14
+ See Tutorial: :ref:`constrainedlayout_guide`
15
+
16
+ General idea:
17
+ -------------
18
+
19
+ First, a figure has a gridspec that divides the figure into nrows and ncols,
20
+ with heights and widths set by ``height_ratios`` and ``width_ratios``,
21
+ often just set to 1 for an equal grid.
22
+
23
+ Subplotspecs that are derived from this gridspec can contain either a
24
+ ``SubPanel``, a ``GridSpecFromSubplotSpec``, or an ``Axes``. The ``SubPanel``
25
+ and ``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
26
+ analogous layout.
27
+
28
+ Each ``GridSpec`` has a ``_layoutgrid`` attached to it. The ``_layoutgrid``
29
+ has the same logical layout as the ``GridSpec``. Each row of the grid spec
30
+ has a top and bottom "margin" and each column has a left and right "margin".
31
+ The "inner" height of each row is constrained to be the same (or as modified
32
+ by ``height_ratio``), and the "inner" width of each column is
33
+ constrained to be the same (as modified by ``width_ratio``), where "inner"
34
+ is the width or height of each column/row minus the size of the margins.
35
+
36
+ Then the size of the margins for each row and column are determined as the
37
+ max width of the decorators on each Axes that has decorators in that margin.
38
+ For instance, a normal Axes would have a left margin that includes the
39
+ left ticklabels, and the ylabel if it exists. The right margin may include a
40
+ colorbar, the bottom margin the xaxis decorations, and the top margin the
41
+ title.
42
+
43
+ With these constraints, the solver then finds appropriate bounds for the
44
+ columns and rows. It's possible that the margins take up the whole figure,
45
+ in which case the algorithm is not applied and a warning is raised.
46
+
47
+ See the tutorial :ref:`constrainedlayout_guide`
48
+ for more discussion of the algorithm with examples.
49
+ """
50
+
51
+ import logging
52
+
53
+ import numpy as np
54
+
55
+ from matplotlib_rs import _api, artist as martist
56
+ import matplotlib_rs.transforms as mtransforms
57
+ import matplotlib_rs._layoutgrid as mlayoutgrid
58
+
59
+
60
+ _log = logging.getLogger(__name__)
61
+
62
+
63
+ ######################################################
64
+ def do_constrained_layout(fig, h_pad, w_pad,
65
+ hspace=None, wspace=None, rect=(0, 0, 1, 1),
66
+ compress=False):
67
+ """
68
+ Do the constrained_layout. Called at draw time in
69
+ ``figure.constrained_layout()``
70
+
71
+ Parameters
72
+ ----------
73
+ fig : `~matplotlib.figure.Figure`
74
+ `.Figure` instance to do the layout in.
75
+
76
+ h_pad, w_pad : float
77
+ Padding around the Axes elements in figure-normalized units.
78
+
79
+ hspace, wspace : float
80
+ Fraction of the figure to dedicate to space between the
81
+ Axes. These are evenly spread between the gaps between the Axes.
82
+ A value of 0.2 for a three-column layout would have a space
83
+ of 0.1 of the figure width between each column.
84
+ If h/wspace < h/w_pad, then the pads are used instead.
85
+
86
+ rect : tuple of 4 floats
87
+ Rectangle in figure coordinates to perform constrained layout in
88
+ [left, bottom, width, height], each from 0-1.
89
+
90
+ compress : bool
91
+ Whether to shift Axes so that white space in between them is
92
+ removed. This is useful for simple grids of fixed-aspect Axes (e.g.
93
+ a grid of images).
94
+
95
+ Returns
96
+ -------
97
+ layoutgrid : private debugging structure
98
+ """
99
+
100
+ renderer = fig._get_renderer()
101
+ # make layoutgrid tree...
102
+ layoutgrids = make_layoutgrids(fig, None, rect=rect)
103
+ if not layoutgrids['hasgrids']:
104
+ _api.warn_external('There are no gridspecs with layoutgrids. '
105
+ 'Possibly did not call parent GridSpec with the'
106
+ ' "figure" keyword')
107
+ return
108
+
109
+ for _ in range(2):
110
+ # do the algorithm twice. This has to be done because decorations
111
+ # change size after the first re-position (i.e. x/yticklabels get
112
+ # larger/smaller). This second reposition tends to be much milder,
113
+ # so doing twice makes things work OK.
114
+
115
+ # make margins for all the Axes and subfigures in the
116
+ # figure. Add margins for colorbars...
117
+ make_layout_margins(layoutgrids, fig, renderer, h_pad=h_pad,
118
+ w_pad=w_pad, hspace=hspace, wspace=wspace)
119
+ make_margin_suptitles(layoutgrids, fig, renderer, h_pad=h_pad,
120
+ w_pad=w_pad)
121
+
122
+ # if a layout is such that a columns (or rows) margin has no
123
+ # constraints, we need to make all such instances in the grid
124
+ # match in margin size.
125
+ match_submerged_margins(layoutgrids, fig)
126
+
127
+ # update all the variables in the layout.
128
+ layoutgrids[fig].update_variables()
129
+
130
+ warn_collapsed = ('constrained_layout not applied because '
131
+ 'axes sizes collapsed to zero. Try making '
132
+ 'figure larger or Axes decorations smaller.')
133
+ if check_no_collapsed_axes(layoutgrids, fig):
134
+ reposition_axes(layoutgrids, fig, renderer, h_pad=h_pad,
135
+ w_pad=w_pad, hspace=hspace, wspace=wspace)
136
+ if compress:
137
+ layoutgrids = compress_fixed_aspect(layoutgrids, fig)
138
+ layoutgrids[fig].update_variables()
139
+ if check_no_collapsed_axes(layoutgrids, fig):
140
+ reposition_axes(layoutgrids, fig, renderer, h_pad=h_pad,
141
+ w_pad=w_pad, hspace=hspace, wspace=wspace,
142
+ compress=True)
143
+ else:
144
+ _api.warn_external(warn_collapsed)
145
+
146
+ if ((suptitle := fig._suptitle) is not None and
147
+ suptitle.get_in_layout() and suptitle._autopos):
148
+ x, _ = suptitle.get_position()
149
+ suptitle.set_position(
150
+ (x, layoutgrids[fig].get_inner_bbox().y1 + h_pad))
151
+ suptitle.set_verticalalignment('bottom')
152
+ else:
153
+ _api.warn_external(warn_collapsed)
154
+ reset_margins(layoutgrids, fig)
155
+ return layoutgrids
156
+
157
+
158
+ def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)):
159
+ """
160
+ Make the layoutgrid tree.
161
+
162
+ (Sub)Figures get a layoutgrid so we can have figure margins.
163
+
164
+ Gridspecs that are attached to Axes get a layoutgrid so Axes
165
+ can have margins.
166
+ """
167
+
168
+ if layoutgrids is None:
169
+ layoutgrids = dict()
170
+ layoutgrids['hasgrids'] = False
171
+ if not hasattr(fig, '_parent'):
172
+ # top figure; pass rect as parent to allow user-specified
173
+ # margins
174
+ layoutgrids[fig] = mlayoutgrid.LayoutGrid(parent=rect, name='figlb')
175
+ else:
176
+ # subfigure
177
+ gs = fig._subplotspec.get_gridspec()
178
+ # it is possible the gridspec containing this subfigure hasn't
179
+ # been added to the tree yet:
180
+ layoutgrids = make_layoutgrids_gs(layoutgrids, gs)
181
+ # add the layoutgrid for the subfigure:
182
+ parentlb = layoutgrids[gs]
183
+ layoutgrids[fig] = mlayoutgrid.LayoutGrid(
184
+ parent=parentlb,
185
+ name='panellb',
186
+ parent_inner=True,
187
+ nrows=1, ncols=1,
188
+ parent_pos=(fig._subplotspec.rowspan,
189
+ fig._subplotspec.colspan))
190
+ # recursively do all subfigures in this figure...
191
+ for sfig in fig.subfigs:
192
+ layoutgrids = make_layoutgrids(sfig, layoutgrids)
193
+
194
+ # for each Axes at the local level add its gridspec:
195
+ for ax in fig._localaxes:
196
+ gs = ax.get_gridspec()
197
+ if gs is not None:
198
+ layoutgrids = make_layoutgrids_gs(layoutgrids, gs)
199
+
200
+ return layoutgrids
201
+
202
+
203
+ def make_layoutgrids_gs(layoutgrids, gs):
204
+ """
205
+ Make the layoutgrid for a gridspec (and anything nested in the gridspec)
206
+ """
207
+
208
+ if gs in layoutgrids or gs.figure is None:
209
+ return layoutgrids
210
+ # in order to do constrained_layout there has to be at least *one*
211
+ # gridspec in the tree:
212
+ layoutgrids['hasgrids'] = True
213
+ if not hasattr(gs, '_subplot_spec'):
214
+ # normal gridspec
215
+ parent = layoutgrids[gs.figure]
216
+ layoutgrids[gs] = mlayoutgrid.LayoutGrid(
217
+ parent=parent,
218
+ parent_inner=True,
219
+ name='gridspec',
220
+ ncols=gs._ncols, nrows=gs._nrows,
221
+ width_ratios=gs.get_width_ratios(),
222
+ height_ratios=gs.get_height_ratios())
223
+ else:
224
+ # this is a gridspecfromsubplotspec:
225
+ subplot_spec = gs._subplot_spec
226
+ parentgs = subplot_spec.get_gridspec()
227
+ # if a nested gridspec it is possible the parent is not in there yet:
228
+ if parentgs not in layoutgrids:
229
+ layoutgrids = make_layoutgrids_gs(layoutgrids, parentgs)
230
+ subspeclb = layoutgrids[parentgs]
231
+ # gridspecfromsubplotspec need an outer container:
232
+ # get a unique representation:
233
+ rep = (gs, 'top')
234
+ if rep not in layoutgrids:
235
+ layoutgrids[rep] = mlayoutgrid.LayoutGrid(
236
+ parent=subspeclb,
237
+ name='top',
238
+ nrows=1, ncols=1,
239
+ parent_pos=(subplot_spec.rowspan, subplot_spec.colspan))
240
+ layoutgrids[gs] = mlayoutgrid.LayoutGrid(
241
+ parent=layoutgrids[rep],
242
+ name='gridspec',
243
+ nrows=gs._nrows, ncols=gs._ncols,
244
+ width_ratios=gs.get_width_ratios(),
245
+ height_ratios=gs.get_height_ratios())
246
+ return layoutgrids
247
+
248
+
249
+ def check_no_collapsed_axes(layoutgrids, fig):
250
+ """
251
+ Check that no Axes have collapsed to zero size.
252
+ """
253
+ for sfig in fig.subfigs:
254
+ ok = check_no_collapsed_axes(layoutgrids, sfig)
255
+ if not ok:
256
+ return False
257
+ for ax in fig.axes:
258
+ gs = ax.get_gridspec()
259
+ if gs in layoutgrids: # also implies gs is not None.
260
+ lg = layoutgrids[gs]
261
+ for i in range(gs.nrows):
262
+ for j in range(gs.ncols):
263
+ bb = lg.get_inner_bbox(i, j)
264
+ if bb.width <= 0 or bb.height <= 0:
265
+ return False
266
+ return True
267
+
268
+
269
+ def compress_fixed_aspect(layoutgrids, fig):
270
+ gs = None
271
+ for ax in fig.axes:
272
+ if ax.get_subplotspec() is None:
273
+ continue
274
+ ax.apply_aspect()
275
+ sub = ax.get_subplotspec()
276
+ _gs = sub.get_gridspec()
277
+ if gs is None:
278
+ gs = _gs
279
+ extraw = np.zeros(gs.ncols)
280
+ extrah = np.zeros(gs.nrows)
281
+ elif _gs != gs:
282
+ raise ValueError('Cannot do compressed layout if Axes are not'
283
+ 'all from the same gridspec')
284
+ orig = ax.get_position(original=True)
285
+ actual = ax.get_position(original=False)
286
+ dw = orig.width - actual.width
287
+ if dw > 0:
288
+ extraw[sub.colspan] = np.maximum(extraw[sub.colspan], dw)
289
+ dh = orig.height - actual.height
290
+ if dh > 0:
291
+ extrah[sub.rowspan] = np.maximum(extrah[sub.rowspan], dh)
292
+
293
+ if gs is None:
294
+ raise ValueError('Cannot do compressed layout if no Axes '
295
+ 'are part of a gridspec.')
296
+ w = np.sum(extraw) / 2
297
+ layoutgrids[fig].edit_margin_min('left', w)
298
+ layoutgrids[fig].edit_margin_min('right', w)
299
+
300
+ h = np.sum(extrah) / 2
301
+ layoutgrids[fig].edit_margin_min('top', h)
302
+ layoutgrids[fig].edit_margin_min('bottom', h)
303
+ return layoutgrids
304
+
305
+
306
+ def get_margin_from_padding(obj, *, w_pad=0, h_pad=0,
307
+ hspace=0, wspace=0):
308
+
309
+ ss = obj._subplotspec
310
+ gs = ss.get_gridspec()
311
+
312
+ if hasattr(gs, 'hspace'):
313
+ _hspace = (gs.hspace if gs.hspace is not None else hspace)
314
+ _wspace = (gs.wspace if gs.wspace is not None else wspace)
315
+ else:
316
+ _hspace = (gs._hspace if gs._hspace is not None else hspace)
317
+ _wspace = (gs._wspace if gs._wspace is not None else wspace)
318
+
319
+ _wspace = _wspace / 2
320
+ _hspace = _hspace / 2
321
+
322
+ nrows, ncols = gs.get_geometry()
323
+ # there are two margins for each direction. The "cb"
324
+ # margins are for pads and colorbars, the non-"cb" are
325
+ # for the Axes decorations (labels etc).
326
+ margin = {'leftcb': w_pad, 'rightcb': w_pad,
327
+ 'bottomcb': h_pad, 'topcb': h_pad,
328
+ 'left': 0, 'right': 0,
329
+ 'top': 0, 'bottom': 0}
330
+ if _wspace / ncols > w_pad:
331
+ if ss.colspan.start > 0:
332
+ margin['leftcb'] = _wspace / ncols
333
+ if ss.colspan.stop < ncols:
334
+ margin['rightcb'] = _wspace / ncols
335
+ if _hspace / nrows > h_pad:
336
+ if ss.rowspan.stop < nrows:
337
+ margin['bottomcb'] = _hspace / nrows
338
+ if ss.rowspan.start > 0:
339
+ margin['topcb'] = _hspace / nrows
340
+
341
+ return margin
342
+
343
+
344
+ def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0,
345
+ hspace=0, wspace=0):
346
+ """
347
+ For each Axes, make a margin between the *pos* layoutbox and the
348
+ *axes* layoutbox be a minimum size that can accommodate the
349
+ decorations on the axis.
350
+
351
+ Then make room for colorbars.
352
+
353
+ Parameters
354
+ ----------
355
+ layoutgrids : dict
356
+ fig : `~matplotlib.figure.Figure`
357
+ `.Figure` instance to do the layout in.
358
+ renderer : `~matplotlib.backend_bases.RendererBase` subclass.
359
+ The renderer to use.
360
+ w_pad, h_pad : float, default: 0
361
+ Width and height padding (in fraction of figure).
362
+ hspace, wspace : float, default: 0
363
+ Width and height padding as fraction of figure size divided by
364
+ number of columns or rows.
365
+ """
366
+ for sfig in fig.subfigs: # recursively make child panel margins
367
+ ss = sfig._subplotspec
368
+ gs = ss.get_gridspec()
369
+
370
+ make_layout_margins(layoutgrids, sfig, renderer,
371
+ w_pad=w_pad, h_pad=h_pad,
372
+ hspace=hspace, wspace=wspace)
373
+
374
+ margins = get_margin_from_padding(sfig, w_pad=0, h_pad=0,
375
+ hspace=hspace, wspace=wspace)
376
+ layoutgrids[gs].edit_outer_margin_mins(margins, ss)
377
+
378
+ for ax in fig._localaxes:
379
+ if not ax.get_subplotspec() or not ax.get_in_layout():
380
+ continue
381
+
382
+ ss = ax.get_subplotspec()
383
+ gs = ss.get_gridspec()
384
+
385
+ if gs not in layoutgrids:
386
+ return
387
+
388
+ margin = get_margin_from_padding(ax, w_pad=w_pad, h_pad=h_pad,
389
+ hspace=hspace, wspace=wspace)
390
+ pos, bbox = get_pos_and_bbox(ax, renderer)
391
+ # the margin is the distance between the bounding box of the Axes
392
+ # and its position (plus the padding from above)
393
+ margin['left'] += pos.x0 - bbox.x0
394
+ margin['right'] += bbox.x1 - pos.x1
395
+ # remember that rows are ordered from top:
396
+ margin['bottom'] += pos.y0 - bbox.y0
397
+ margin['top'] += bbox.y1 - pos.y1
398
+
399
+ # make margin for colorbars. These margins go in the
400
+ # padding margin, versus the margin for Axes decorators.
401
+ for cbax in ax._colorbars:
402
+ # note pad is a fraction of the parent width...
403
+ pad = colorbar_get_pad(layoutgrids, cbax)
404
+ # colorbars can be child of more than one subplot spec:
405
+ cbp_rspan, cbp_cspan = get_cb_parent_spans(cbax)
406
+ loc = cbax._colorbar_info['location']
407
+ cbpos, cbbbox = get_pos_and_bbox(cbax, renderer)
408
+ if loc == 'right':
409
+ if cbp_cspan.stop == ss.colspan.stop:
410
+ # only increase if the colorbar is on the right edge
411
+ margin['rightcb'] += cbbbox.width + pad
412
+ elif loc == 'left':
413
+ if cbp_cspan.start == ss.colspan.start:
414
+ # only increase if the colorbar is on the left edge
415
+ margin['leftcb'] += cbbbox.width + pad
416
+ elif loc == 'top':
417
+ if cbp_rspan.start == ss.rowspan.start:
418
+ margin['topcb'] += cbbbox.height + pad
419
+ else:
420
+ if cbp_rspan.stop == ss.rowspan.stop:
421
+ margin['bottomcb'] += cbbbox.height + pad
422
+ # If the colorbars are wider than the parent box in the
423
+ # cross direction
424
+ if loc in ['top', 'bottom']:
425
+ if (cbp_cspan.start == ss.colspan.start and
426
+ cbbbox.x0 < bbox.x0):
427
+ margin['left'] += bbox.x0 - cbbbox.x0
428
+ if (cbp_cspan.stop == ss.colspan.stop and
429
+ cbbbox.x1 > bbox.x1):
430
+ margin['right'] += cbbbox.x1 - bbox.x1
431
+ # or taller:
432
+ if loc in ['left', 'right']:
433
+ if (cbp_rspan.stop == ss.rowspan.stop and
434
+ cbbbox.y0 < bbox.y0):
435
+ margin['bottom'] += bbox.y0 - cbbbox.y0
436
+ if (cbp_rspan.start == ss.rowspan.start and
437
+ cbbbox.y1 > bbox.y1):
438
+ margin['top'] += cbbbox.y1 - bbox.y1
439
+ # pass the new margins down to the layout grid for the solution...
440
+ layoutgrids[gs].edit_outer_margin_mins(margin, ss)
441
+
442
+ # make margins for figure-level legends:
443
+ for leg in fig.legends:
444
+ inv_trans_fig = None
445
+ if leg._outside_loc and leg._bbox_to_anchor is None:
446
+ if inv_trans_fig is None:
447
+ inv_trans_fig = fig.transFigure.inverted().transform_bbox
448
+ bbox = inv_trans_fig(leg.get_tightbbox(renderer))
449
+ w = bbox.width + 2 * w_pad
450
+ h = bbox.height + 2 * h_pad
451
+ legendloc = leg._outside_loc
452
+ if legendloc == 'lower':
453
+ layoutgrids[fig].edit_margin_min('bottom', h)
454
+ elif legendloc == 'upper':
455
+ layoutgrids[fig].edit_margin_min('top', h)
456
+ if legendloc == 'right':
457
+ layoutgrids[fig].edit_margin_min('right', w)
458
+ elif legendloc == 'left':
459
+ layoutgrids[fig].edit_margin_min('left', w)
460
+
461
+
462
+ def make_margin_suptitles(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0):
463
+ # Figure out how large the suptitle is and make the
464
+ # top level figure margin larger.
465
+
466
+ inv_trans_fig = fig.transFigure.inverted().transform_bbox
467
+ # get the h_pad and w_pad as distances in the local subfigure coordinates:
468
+ padbox = mtransforms.Bbox([[0, 0], [w_pad, h_pad]])
469
+ padbox = (fig.transFigure -
470
+ fig.transSubfigure).transform_bbox(padbox)
471
+ h_pad_local = padbox.height
472
+ w_pad_local = padbox.width
473
+
474
+ for sfig in fig.subfigs:
475
+ make_margin_suptitles(layoutgrids, sfig, renderer,
476
+ w_pad=w_pad, h_pad=h_pad)
477
+
478
+ if fig._suptitle is not None and fig._suptitle.get_in_layout():
479
+ p = fig._suptitle.get_position()
480
+ if getattr(fig._suptitle, '_autopos', False):
481
+ fig._suptitle.set_position((p[0], 1 - h_pad_local))
482
+ bbox = inv_trans_fig(fig._suptitle.get_tightbbox(renderer))
483
+ layoutgrids[fig].edit_margin_min('top', bbox.height + 2 * h_pad)
484
+
485
+ if fig._supxlabel is not None and fig._supxlabel.get_in_layout():
486
+ p = fig._supxlabel.get_position()
487
+ if getattr(fig._supxlabel, '_autopos', False):
488
+ fig._supxlabel.set_position((p[0], h_pad_local))
489
+ bbox = inv_trans_fig(fig._supxlabel.get_tightbbox(renderer))
490
+ layoutgrids[fig].edit_margin_min('bottom',
491
+ bbox.height + 2 * h_pad)
492
+
493
+ if fig._supylabel is not None and fig._supylabel.get_in_layout():
494
+ p = fig._supylabel.get_position()
495
+ if getattr(fig._supylabel, '_autopos', False):
496
+ fig._supylabel.set_position((w_pad_local, p[1]))
497
+ bbox = inv_trans_fig(fig._supylabel.get_tightbbox(renderer))
498
+ layoutgrids[fig].edit_margin_min('left', bbox.width + 2 * w_pad)
499
+
500
+
501
+ def match_submerged_margins(layoutgrids, fig):
502
+ """
503
+ Make the margins that are submerged inside an Axes the same size.
504
+
505
+ This allows Axes that span two columns (or rows) that are offset
506
+ from one another to have the same size.
507
+
508
+ This gives the proper layout for something like::
509
+ fig = plt.figure(constrained_layout=True)
510
+ axs = fig.subplot_mosaic("AAAB\nCCDD")
511
+
512
+ Without this routine, the Axes D will be wider than C, because the
513
+ margin width between the two columns in C has no width by default,
514
+ whereas the margins between the two columns of D are set by the
515
+ width of the margin between A and B. However, obviously the user would
516
+ like C and D to be the same size, so we need to add constraints to these
517
+ "submerged" margins.
518
+
519
+ This routine makes all the interior margins the same, and the spacing
520
+ between the three columns in A and the two column in C are all set to the
521
+ margins between the two columns of D.
522
+
523
+ See test_constrained_layout::test_constrained_layout12 for an example.
524
+ """
525
+
526
+ axsdone = []
527
+ for sfig in fig.subfigs:
528
+ axsdone += match_submerged_margins(layoutgrids, sfig)
529
+
530
+ axs = [a for a in fig.get_axes()
531
+ if (a.get_subplotspec() is not None and a.get_in_layout() and
532
+ a not in axsdone)]
533
+
534
+ for ax1 in axs:
535
+ ss1 = ax1.get_subplotspec()
536
+ if ss1.get_gridspec() not in layoutgrids:
537
+ axs.remove(ax1)
538
+ continue
539
+ lg1 = layoutgrids[ss1.get_gridspec()]
540
+
541
+ # interior columns:
542
+ if len(ss1.colspan) > 1:
543
+ leftcb = lg1.margin_vals['leftcb'][ss1.colspan[1:]]
544
+ rightcb = lg1.margin_vals['rightcb'][ss1.colspan[:-1]]
545
+ maxsubl = np.max(lg1.margin_vals['left'][ss1.colspan[1:]] + leftcb)
546
+ maxsubr = np.max(lg1.margin_vals['right'][ss1.colspan[:-1]] + rightcb)
547
+ for ax2 in axs:
548
+ ss2 = ax2.get_subplotspec()
549
+ lg2 = layoutgrids[ss2.get_gridspec()]
550
+ if lg2 is not None and len(ss2.colspan) > 1:
551
+ maxsubl2 = np.max(
552
+ lg2.margin_vals['left'][ss2.colspan[1:]] +
553
+ lg2.margin_vals['leftcb'][ss2.colspan[1:]])
554
+ if maxsubl2 > maxsubl:
555
+ maxsubl = maxsubl2
556
+ maxsubr2 = np.max(
557
+ lg2.margin_vals['right'][ss2.colspan[:-1]] +
558
+ lg2.margin_vals['rightcb'][ss2.colspan[:-1]])
559
+ if maxsubr2 > maxsubr:
560
+ maxsubr = maxsubr2
561
+ for i, cb in zip(ss1.colspan[1:], leftcb):
562
+ lg1.edit_margin_min('left', maxsubl - cb, cell=i)
563
+ for i, cb in zip(ss1.colspan[:-1], rightcb):
564
+ lg1.edit_margin_min('right', maxsubr - cb, cell=i)
565
+
566
+ # interior rows:
567
+ if len(ss1.rowspan) > 1:
568
+ topcb = lg1.margin_vals['topcb'][ss1.rowspan[1:]]
569
+ bottomcb = lg1.margin_vals['bottomcb'][ss1.rowspan[:-1]]
570
+ maxsubt = np.max(lg1.margin_vals['top'][ss1.rowspan[1:]] + topcb)
571
+ maxsubb = np.max(lg1.margin_vals['bottom'][ss1.rowspan[:-1]] + bottomcb)
572
+ for ax2 in axs:
573
+ ss2 = ax2.get_subplotspec()
574
+ lg2 = layoutgrids[ss2.get_gridspec()]
575
+ if lg2 is not None:
576
+ if len(ss2.rowspan) > 1:
577
+ maxsubt = np.max([np.max(
578
+ lg2.margin_vals['top'][ss2.rowspan[1:]] +
579
+ lg2.margin_vals['topcb'][ss2.rowspan[1:]]
580
+ ), maxsubt])
581
+ maxsubb = np.max([np.max(
582
+ lg2.margin_vals['bottom'][ss2.rowspan[:-1]] +
583
+ lg2.margin_vals['bottomcb'][ss2.rowspan[:-1]]
584
+ ), maxsubb])
585
+ for i, cb in zip(ss1.rowspan[1:], topcb):
586
+ lg1.edit_margin_min('top', maxsubt - cb, cell=i)
587
+ for i, cb in zip(ss1.rowspan[:-1], bottomcb):
588
+ lg1.edit_margin_min('bottom', maxsubb - cb, cell=i)
589
+
590
+ return axs
591
+
592
+
593
+ def get_cb_parent_spans(cbax):
594
+ """
595
+ Figure out which subplotspecs this colorbar belongs to.
596
+
597
+ Parameters
598
+ ----------
599
+ cbax : `~matplotlib.axes.Axes`
600
+ Axes for the colorbar.
601
+ """
602
+ rowstart = np.inf
603
+ rowstop = -np.inf
604
+ colstart = np.inf
605
+ colstop = -np.inf
606
+ for parent in cbax._colorbar_info['parents']:
607
+ ss = parent.get_subplotspec()
608
+ rowstart = min(ss.rowspan.start, rowstart)
609
+ rowstop = max(ss.rowspan.stop, rowstop)
610
+ colstart = min(ss.colspan.start, colstart)
611
+ colstop = max(ss.colspan.stop, colstop)
612
+
613
+ rowspan = range(rowstart, rowstop)
614
+ colspan = range(colstart, colstop)
615
+ return rowspan, colspan
616
+
617
+
618
+ def get_pos_and_bbox(ax, renderer):
619
+ """
620
+ Get the position and the bbox for the Axes.
621
+
622
+ Parameters
623
+ ----------
624
+ ax : `~matplotlib.axes.Axes`
625
+ renderer : `~matplotlib.backend_bases.RendererBase` subclass.
626
+
627
+ Returns
628
+ -------
629
+ pos : `~matplotlib.transforms.Bbox`
630
+ Position in figure coordinates.
631
+ bbox : `~matplotlib.transforms.Bbox`
632
+ Tight bounding box in figure coordinates.
633
+ """
634
+ fig = ax.get_figure(root=False)
635
+ pos = ax.get_position(original=True)
636
+ # pos is in panel co-ords, but we need in figure for the layout
637
+ pos = pos.transformed(fig.transSubfigure - fig.transFigure)
638
+ tightbbox = martist._get_tightbbox_for_layout_only(ax, renderer)
639
+ if tightbbox is None:
640
+ bbox = pos
641
+ else:
642
+ bbox = tightbbox.transformed(fig.transFigure.inverted())
643
+ return pos, bbox
644
+
645
+
646
+ def reposition_axes(layoutgrids, fig, renderer, *,
647
+ w_pad=0, h_pad=0, hspace=0, wspace=0, compress=False):
648
+ """
649
+ Reposition all the Axes based on the new inner bounding box.
650
+ """
651
+ trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
652
+ for sfig in fig.subfigs:
653
+ bbox = layoutgrids[sfig].get_outer_bbox()
654
+ sfig._redo_transform_rel_fig(
655
+ bbox=bbox.transformed(trans_fig_to_subfig))
656
+ reposition_axes(layoutgrids, sfig, renderer,
657
+ w_pad=w_pad, h_pad=h_pad,
658
+ wspace=wspace, hspace=hspace, compress=compress)
659
+
660
+ for ax in fig._localaxes:
661
+ if ax.get_subplotspec() is None or not ax.get_in_layout():
662
+ continue
663
+
664
+ # grid bbox is in Figure coordinates, but we specify in panel
665
+ # coordinates...
666
+ ss = ax.get_subplotspec()
667
+ gs = ss.get_gridspec()
668
+ if gs not in layoutgrids:
669
+ return
670
+
671
+ bbox = layoutgrids[gs].get_inner_bbox(rows=ss.rowspan,
672
+ cols=ss.colspan)
673
+
674
+ # transform from figure to panel for set_position:
675
+ newbbox = trans_fig_to_subfig.transform_bbox(bbox)
676
+ ax._set_position(newbbox)
677
+
678
+ # move the colorbars:
679
+ # we need to keep track of oldw and oldh if there is more than
680
+ # one colorbar:
681
+ offset = {'left': 0, 'right': 0, 'bottom': 0, 'top': 0}
682
+ for nn, cbax in enumerate(ax._colorbars[::-1]):
683
+ if ax == cbax._colorbar_info['parents'][0]:
684
+ reposition_colorbar(layoutgrids, cbax, renderer,
685
+ offset=offset, compress=compress)
686
+
687
+
688
+ def reposition_colorbar(layoutgrids, cbax, renderer, *, offset=None, compress=False):
689
+ """
690
+ Place the colorbar in its new place.
691
+
692
+ Parameters
693
+ ----------
694
+ layoutgrids : dict
695
+ cbax : `~matplotlib.axes.Axes`
696
+ Axes for the colorbar.
697
+ renderer : `~matplotlib.backend_bases.RendererBase` subclass.
698
+ The renderer to use.
699
+ offset : array-like
700
+ Offset the colorbar needs to be pushed to in order to
701
+ account for multiple colorbars.
702
+ compress : bool
703
+ Whether we're in compressed layout mode.
704
+ """
705
+
706
+ parents = cbax._colorbar_info['parents']
707
+ gs = parents[0].get_gridspec()
708
+ fig = cbax.get_figure(root=False)
709
+ trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
710
+
711
+ cb_rspans, cb_cspans = get_cb_parent_spans(cbax)
712
+ bboxparent = layoutgrids[gs].get_bbox_for_cb(rows=cb_rspans,
713
+ cols=cb_cspans)
714
+ pb = layoutgrids[gs].get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
715
+
716
+ location = cbax._colorbar_info['location']
717
+ anchor = cbax._colorbar_info['anchor']
718
+ fraction = cbax._colorbar_info['fraction']
719
+ aspect = cbax._colorbar_info['aspect']
720
+ shrink = cbax._colorbar_info['shrink']
721
+
722
+ # For colorbars with a single parent in compressed layout,
723
+ # use the actual visual size of the parent axis after apply_aspect()
724
+ # has been called. This ensures colorbars align with their parent axes.
725
+ # This fix is specific to single-parent colorbars where alignment is critical.
726
+ if compress and len(parents) == 1:
727
+ from matplotlib_rs.transforms import Bbox
728
+ # Get the actual parent position after apply_aspect()
729
+ parent_ax = parents[0]
730
+ actual_pos = parent_ax.get_position(original=False)
731
+ # Transform to figure coordinates
732
+ actual_pos_fig = actual_pos.transformed(fig.transSubfigure - fig.transFigure)
733
+
734
+ if location in ('left', 'right'):
735
+ # For vertical colorbars, use the actual parent bbox height
736
+ # for colorbar sizing
737
+ # Keep the pb x-coordinates but use actual y-coordinates
738
+ pb = Bbox.from_extents(pb.x0, actual_pos_fig.y0,
739
+ pb.x1, actual_pos_fig.y1)
740
+ elif location in ('top', 'bottom'):
741
+ # For horizontal colorbars, use the actual parent bbox width
742
+ # for colorbar sizing
743
+ # Keep the pb y-coordinates but use actual x-coordinates
744
+ pb = Bbox.from_extents(actual_pos_fig.x0, pb.y0,
745
+ actual_pos_fig.x1, pb.y1)
746
+
747
+ cbpos, cbbbox = get_pos_and_bbox(cbax, renderer)
748
+
749
+ # Colorbar gets put at extreme edge of outer bbox of the subplotspec
750
+ # It needs to be moved in by: 1) a pad 2) its "margin" 3) by
751
+ # any colorbars already added at this location:
752
+ cbpad = colorbar_get_pad(layoutgrids, cbax)
753
+ if location in ('left', 'right'):
754
+ # fraction and shrink are fractions of parent
755
+ pbcb = pb.shrunk(fraction, shrink).anchored(anchor, pb)
756
+ # The colorbar is at the left side of the parent. Need
757
+ # to translate to right (or left)
758
+ if location == 'right':
759
+ lmargin = cbpos.x0 - cbbbox.x0
760
+ dx = bboxparent.x1 - pbcb.x0 + offset['right']
761
+ dx += cbpad + lmargin
762
+ offset['right'] += cbbbox.width + cbpad
763
+ pbcb = pbcb.translated(dx, 0)
764
+ else:
765
+ lmargin = cbpos.x0 - cbbbox.x0
766
+ dx = bboxparent.x0 - pbcb.x0 # edge of parent
767
+ dx += -cbbbox.width - cbpad + lmargin - offset['left']
768
+ offset['left'] += cbbbox.width + cbpad
769
+ pbcb = pbcb.translated(dx, 0)
770
+ else: # horizontal axes:
771
+ pbcb = pb.shrunk(shrink, fraction).anchored(anchor, pb)
772
+ if location == 'top':
773
+ bmargin = cbpos.y0 - cbbbox.y0
774
+ dy = bboxparent.y1 - pbcb.y0 + offset['top']
775
+ dy += cbpad + bmargin
776
+ offset['top'] += cbbbox.height + cbpad
777
+ pbcb = pbcb.translated(0, dy)
778
+ else:
779
+ bmargin = cbpos.y0 - cbbbox.y0
780
+ dy = bboxparent.y0 - pbcb.y0
781
+ dy += -cbbbox.height - cbpad + bmargin - offset['bottom']
782
+ offset['bottom'] += cbbbox.height + cbpad
783
+ pbcb = pbcb.translated(0, dy)
784
+
785
+ pbcb = trans_fig_to_subfig.transform_bbox(pbcb)
786
+ cbax.set_transform(fig.transSubfigure)
787
+ cbax._set_position(pbcb)
788
+ cbax.set_anchor(anchor)
789
+ if location in ['bottom', 'top']:
790
+ aspect = 1 / aspect
791
+ cbax.set_box_aspect(aspect)
792
+ cbax.set_aspect('auto')
793
+ return offset
794
+
795
+
796
+ def reset_margins(layoutgrids, fig):
797
+ """
798
+ Reset the margins in the layoutboxes of *fig*.
799
+
800
+ Margins are usually set as a minimum, so if the figure gets smaller
801
+ the minimum needs to be zero in order for it to grow again.
802
+ """
803
+ for sfig in fig.subfigs:
804
+ reset_margins(layoutgrids, sfig)
805
+ for ax in fig.axes:
806
+ if ax.get_in_layout():
807
+ gs = ax.get_gridspec()
808
+ if gs in layoutgrids: # also implies gs is not None.
809
+ layoutgrids[gs].reset_margins()
810
+ layoutgrids[fig].reset_margins()
811
+
812
+
813
+ def colorbar_get_pad(layoutgrids, cax):
814
+ parents = cax._colorbar_info['parents']
815
+ gs = parents[0].get_gridspec()
816
+
817
+ cb_rspans, cb_cspans = get_cb_parent_spans(cax)
818
+ bboxouter = layoutgrids[gs].get_inner_bbox(rows=cb_rspans, cols=cb_cspans)
819
+
820
+ if cax._colorbar_info['location'] in ['right', 'left']:
821
+ size = bboxouter.width
822
+ else:
823
+ size = bboxouter.height
824
+
825
+ return cax._colorbar_info['pad'] * size