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.
- docs/releases/0.0.1.md +268 -0
- docs/releases/0.0.2.md +69 -0
- docs/releases/0.0.3.md +80 -0
- docs/releases/0.0.4.md +73 -0
- docs/releases/0.0.5.md +24 -0
- docs/releases/0.0.6.md +24 -0
- docs/releases/0.0.7.md +24 -0
- docs/releases/0.0.8.md +16 -0
- licenses/LICENSE_CONTOURPY +29 -0
- licenses/LICENSE_CYCLER +27 -0
- licenses/LICENSE_DATEUTIL +54 -0
- licenses/LICENSE_KIWISOLVER +71 -0
- licenses/LICENSE_LIBWEBP +56 -0
- licenses/LICENSE_MATPLOTLIB +1253 -0
- licenses/LICENSE_PYPARSING +20 -0
- licenses/LICENSE_QHULL +39 -0
- licenses/LICENSE_SIX +18 -0
- matplotlib_rs/__init__.py +1683 -0
- matplotlib_rs/__main__.py +27 -0
- matplotlib_rs/_afm.py +500 -0
- matplotlib_rs/_animation_data.py +263 -0
- matplotlib_rs/_api/__init__.py +495 -0
- matplotlib_rs/_api/deprecation.py +534 -0
- matplotlib_rs/_axis_py.py +2991 -0
- matplotlib_rs/_blocking_input.py +31 -0
- matplotlib_rs/_cm.py +1500 -0
- matplotlib_rs/_cm_bivar.py +1289 -0
- matplotlib_rs/_cm_listed.py +2848 -0
- matplotlib_rs/_cm_multivar.py +167 -0
- matplotlib_rs/_color_data.py +1142 -0
- matplotlib_rs/_colormap.py +132 -0
- matplotlib_rs/_constrained_layout.py +825 -0
- matplotlib_rs/_contour.py +108 -0
- matplotlib_rs/_doc_cache.py +12214 -0
- matplotlib_rs/_docstring.py +142 -0
- matplotlib_rs/_enums.py +178 -0
- matplotlib_rs/_figure_rs.py +294 -0
- matplotlib_rs/_fontconfig_pattern.py +129 -0
- matplotlib_rs/_foreign.py +220 -0
- matplotlib_rs/_hook.py +94 -0
- matplotlib_rs/_image.py +160 -0
- matplotlib_rs/_imageio.py +229 -0
- matplotlib_rs/_internal_utils.py +65 -0
- matplotlib_rs/_kiwi.py +484 -0
- matplotlib_rs/_layoutgrid.py +549 -0
- matplotlib_rs/_live.py +192 -0
- matplotlib_rs/_mathtext.py +3103 -0
- matplotlib_rs/_mathtext_data.py +1811 -0
- matplotlib_rs/_mplrs.cp315-win_amd64.pyd +0 -0
- matplotlib_rs/_path.py +25 -0
- matplotlib_rs/_png.py +162 -0
- matplotlib_rs/_pylab_helpers.py +137 -0
- matplotlib_rs/_qhull.py +66 -0
- matplotlib_rs/_rcpush.py +84 -0
- matplotlib_rs/_spines_rs.py +108 -0
- matplotlib_rs/_style_helpers.py +52 -0
- matplotlib_rs/_text_helpers.py +51 -0
- matplotlib_rs/_tight_bbox.py +85 -0
- matplotlib_rs/_tight_layout.py +302 -0
- matplotlib_rs/_tri.py +140 -0
- matplotlib_rs/_type1font.py +1228 -0
- matplotlib_rs/_vendor/__init__.py +8 -0
- matplotlib_rs/_vendor/cycler.py +574 -0
- matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
- matplotlib_rs/_vendor/dateutil/_common.py +44 -0
- matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
- matplotlib_rs/_vendor/dateutil/_version.py +5 -0
- matplotlib_rs/_vendor/dateutil/easter.py +90 -0
- matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
- matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
- matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
- matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
- matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
- matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
- matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
- matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
- matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
- matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
- matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
- matplotlib_rs/_vendor/dateutil/utils.py +72 -0
- matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
- matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
- matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
- matplotlib_rs/_vendor/pyparsing/common.py +571 -0
- matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
- matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
- matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
- matplotlib_rs/_vendor/pyparsing/results.py +929 -0
- matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
- matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
- matplotlib_rs/_vendor/pyparsing/util.py +515 -0
- matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
- matplotlib_rs/_vendor/six.py +1004 -0
- matplotlib_rs/animation.py +1843 -0
- matplotlib_rs/artist.py +2302 -0
- matplotlib_rs/axes/__init__.py +19 -0
- matplotlib_rs/axes/_axes.py +9402 -0
- matplotlib_rs/axes/_bar.py +185 -0
- matplotlib_rs/axes/_base.py +5236 -0
- matplotlib_rs/axes/_base_rs.py +727 -0
- matplotlib_rs/axes/_boxplot.py +391 -0
- matplotlib_rs/axes/_hist.py +99 -0
- matplotlib_rs/axes/_secondary_axes.py +357 -0
- matplotlib_rs/axis.py +1963 -0
- matplotlib_rs/backend_bases.py +3760 -0
- matplotlib_rs/backend_managers.py +388 -0
- matplotlib_rs/backend_tools.py +1002 -0
- matplotlib_rs/backends/__init__.py +6 -0
- matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
- matplotlib_rs/backends/backend_agg.py +552 -0
- matplotlib_rs/backends/backend_mixed.py +123 -0
- matplotlib_rs/backends/backend_pdf.py +2711 -0
- matplotlib_rs/backends/backend_pgf.py +1031 -0
- matplotlib_rs/backends/backend_ps.py +1491 -0
- matplotlib_rs/backends/backend_svg.py +1395 -0
- matplotlib_rs/backends/backend_template.py +214 -0
- matplotlib_rs/backends/registry.py +423 -0
- matplotlib_rs/bezier.py +691 -0
- matplotlib_rs/category.py +236 -0
- matplotlib_rs/cbook.py +2762 -0
- matplotlib_rs/cm.py +251 -0
- matplotlib_rs/collections.py +2711 -0
- matplotlib_rs/colorbar.py +1586 -0
- matplotlib_rs/colorizer.py +909 -0
- matplotlib_rs/colors.py +4278 -0
- matplotlib_rs/container.py +256 -0
- matplotlib_rs/contour.py +1756 -0
- matplotlib_rs/dates.py +1847 -0
- matplotlib_rs/dviread.py +1386 -0
- matplotlib_rs/figure.py +3815 -0
- matplotlib_rs/font_manager.py +1855 -0
- matplotlib_rs/ft2font.py +515 -0
- matplotlib_rs/gridspec.py +808 -0
- matplotlib_rs/hatch.py +244 -0
- matplotlib_rs/image.py +1863 -0
- matplotlib_rs/inset.py +291 -0
- matplotlib_rs/layout_engine.py +310 -0
- matplotlib_rs/legend.py +1480 -0
- matplotlib_rs/legend_handler.py +812 -0
- matplotlib_rs/lines.py +1886 -0
- matplotlib_rs/markers.py +908 -0
- matplotlib_rs/mathtext.py +141 -0
- matplotlib_rs/mlab.py +959 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
- matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
- matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/back.pdf +0 -0
- matplotlib_rs/mpl-data/images/back.png +0 -0
- matplotlib_rs/mpl-data/images/back.svg +46 -0
- matplotlib_rs/mpl-data/images/back_large.png +0 -0
- matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
- matplotlib_rs/mpl-data/images/filesave.png +0 -0
- matplotlib_rs/mpl-data/images/filesave.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
- matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/forward.pdf +0 -0
- matplotlib_rs/mpl-data/images/forward.png +0 -0
- matplotlib_rs/mpl-data/images/forward.svg +46 -0
- matplotlib_rs/mpl-data/images/forward_large.png +0 -0
- matplotlib_rs/mpl-data/images/hand.pdf +0 -0
- matplotlib_rs/mpl-data/images/hand.png +0 -0
- matplotlib_rs/mpl-data/images/hand.svg +130 -0
- matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
- matplotlib_rs/mpl-data/images/help.pdf +71 -0
- matplotlib_rs/mpl-data/images/help.png +0 -0
- matplotlib_rs/mpl-data/images/help.svg +52 -0
- matplotlib_rs/mpl-data/images/help_large.png +0 -0
- matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
- matplotlib_rs/mpl-data/images/home.pdf +0 -0
- matplotlib_rs/mpl-data/images/home.png +0 -0
- matplotlib_rs/mpl-data/images/home.svg +59 -0
- matplotlib_rs/mpl-data/images/home_large.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
- matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
- matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
- matplotlib_rs/mpl-data/images/move.pdf +0 -0
- matplotlib_rs/mpl-data/images/move.png +0 -0
- matplotlib_rs/mpl-data/images/move.svg +73 -0
- matplotlib_rs/mpl-data/images/move_large.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
- matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
- matplotlib_rs/mpl-data/images/subplots.png +0 -0
- matplotlib_rs/mpl-data/images/subplots.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
- matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
- matplotlib_rs/mpl-data/matplotlibrc +849 -0
- matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
- matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
- matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
- matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
- matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
- matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
- matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
- matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
- matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
- matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
- matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
- matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
- matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
- matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
- matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
- matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
- matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
- matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
- matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
- matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
- matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
- matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
- matplotlib_rs/mpl_toolkits/__init__.py +3 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
- matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
- matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
- matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
- matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
- matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
- matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
- matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
- matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
- matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
- matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
- matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
- matplotlib_rs/offsetbox.py +1726 -0
- matplotlib_rs/patches.py +5049 -0
- matplotlib_rs/path.py +1147 -0
- matplotlib_rs/patheffects.py +512 -0
- matplotlib_rs/projections/__init__.py +126 -0
- matplotlib_rs/projections/geo.py +512 -0
- matplotlib_rs/projections/polar.py +1518 -0
- matplotlib_rs/pylab.py +68 -0
- matplotlib_rs/pyplot.py +4834 -0
- matplotlib_rs/quiver.py +1236 -0
- matplotlib_rs/rcsetup.py +3435 -0
- matplotlib_rs/sankey.py +815 -0
- matplotlib_rs/scale.py +1002 -0
- matplotlib_rs/spines.py +618 -0
- matplotlib_rs/stackplot.py +144 -0
- matplotlib_rs/streamplot.py +768 -0
- matplotlib_rs/style/__init__.py +269 -0
- matplotlib_rs/style/core.py +28 -0
- matplotlib_rs/table.py +860 -0
- matplotlib_rs/texmanager.py +375 -0
- matplotlib_rs/text.py +2412 -0
- matplotlib_rs/textpath.py +377 -0
- matplotlib_rs/ticker.py +3111 -0
- matplotlib_rs/transforms.py +3069 -0
- matplotlib_rs/tri/__init__.py +24 -0
- matplotlib_rs/tri/_triangulation.py +248 -0
- matplotlib_rs/tri/_tricontour.py +271 -0
- matplotlib_rs/tri/_trifinder.py +97 -0
- matplotlib_rs/tri/_triinterpolate.py +1575 -0
- matplotlib_rs/tri/_tripcolor.py +170 -0
- matplotlib_rs/tri/_triplot.py +87 -0
- matplotlib_rs/tri/_trirefine.py +308 -0
- matplotlib_rs/tri/_tritools.py +264 -0
- matplotlib_rs/typing.py +597 -0
- matplotlib_rs/units.py +196 -0
- matplotlib_rs/widgets.py +4455 -0
- matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
- matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
- matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
- matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
matplotlib_rs/table.py
ADDED
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
# Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
|
|
2
|
+
# Original code by:
|
|
3
|
+
# John Gill <jng@europe.renre.com>
|
|
4
|
+
# Copyright 2004 John Gill and John Hunter
|
|
5
|
+
#
|
|
6
|
+
# Subsequent changes:
|
|
7
|
+
# The Matplotlib development team
|
|
8
|
+
# Copyright The Matplotlib development team
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Tables drawing.
|
|
12
|
+
|
|
13
|
+
.. note::
|
|
14
|
+
The table implementation in Matplotlib is lightly maintained. For a more
|
|
15
|
+
featureful table implementation, you may wish to try `blume
|
|
16
|
+
<https://github.com/swfiua/blume>`_.
|
|
17
|
+
|
|
18
|
+
Use the factory function `~matplotlib.table.table` to create a ready-made
|
|
19
|
+
table from texts. If you need more control, use the `.Table` class and its
|
|
20
|
+
methods.
|
|
21
|
+
|
|
22
|
+
The table consists of a grid of cells, which are indexed by (row, column).
|
|
23
|
+
The cell (0, 0) is positioned at the top left.
|
|
24
|
+
|
|
25
|
+
Thanks to John Gill for providing the class and table.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
import numpy as np
|
|
29
|
+
|
|
30
|
+
from . import _api, _docstring
|
|
31
|
+
from .artist import Artist, allow_rasterization
|
|
32
|
+
from .patches import Rectangle
|
|
33
|
+
from .text import Text
|
|
34
|
+
from .transforms import Bbox
|
|
35
|
+
from .path import Path
|
|
36
|
+
|
|
37
|
+
from .cbook import _is_pandas_dataframe
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Cell(Rectangle):
|
|
41
|
+
"""
|
|
42
|
+
A cell is a `.Rectangle` with some associated `.Text`.
|
|
43
|
+
|
|
44
|
+
As a user, you'll most likely not creates cells yourself. Instead, you
|
|
45
|
+
should use either the `~matplotlib.table.table` factory function or
|
|
46
|
+
`.Table.add_cell`.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
PAD = 0.1
|
|
50
|
+
"""Padding between text and rectangle."""
|
|
51
|
+
|
|
52
|
+
_edges = 'BRTL'
|
|
53
|
+
_edge_aliases = {'open': '',
|
|
54
|
+
'closed': _edges, # default
|
|
55
|
+
'horizontal': 'BT',
|
|
56
|
+
'vertical': 'RL'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
def __init__(self, xy, width, height, *,
|
|
60
|
+
edgecolor='k', facecolor='w',
|
|
61
|
+
fill=True,
|
|
62
|
+
text='',
|
|
63
|
+
loc='right',
|
|
64
|
+
fontproperties=None,
|
|
65
|
+
visible_edges='closed',
|
|
66
|
+
):
|
|
67
|
+
"""
|
|
68
|
+
Parameters
|
|
69
|
+
----------
|
|
70
|
+
xy : 2-tuple
|
|
71
|
+
The position of the bottom left corner of the cell.
|
|
72
|
+
width : float
|
|
73
|
+
The cell width.
|
|
74
|
+
height : float
|
|
75
|
+
The cell height.
|
|
76
|
+
edgecolor : :mpltype:`color`, default: 'k'
|
|
77
|
+
The color of the cell border.
|
|
78
|
+
facecolor : :mpltype:`color`, default: 'w'
|
|
79
|
+
The cell facecolor.
|
|
80
|
+
fill : bool, default: True
|
|
81
|
+
Whether the cell background is filled.
|
|
82
|
+
text : str, optional
|
|
83
|
+
The cell text.
|
|
84
|
+
loc : {'right', 'center', 'left'}
|
|
85
|
+
The alignment of the text within the cell.
|
|
86
|
+
fontproperties : dict, optional
|
|
87
|
+
A dict defining the font properties of the text. Supported keys and
|
|
88
|
+
values are the keyword arguments accepted by `.FontProperties`.
|
|
89
|
+
visible_edges : {'closed', 'open', 'horizontal', 'vertical'} or \
|
|
90
|
+
substring of 'BRTL'
|
|
91
|
+
The cell edges to be drawn with a line: a substring of 'BRTL'
|
|
92
|
+
(bottom, right, top, left), or one of 'open' (no edges drawn),
|
|
93
|
+
'closed' (all edges drawn), 'horizontal' (bottom and top),
|
|
94
|
+
'vertical' (right and left).
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
# Call base
|
|
98
|
+
super().__init__(xy, width=width, height=height, fill=fill,
|
|
99
|
+
edgecolor=edgecolor, facecolor=facecolor)
|
|
100
|
+
self.set_clip_on(False)
|
|
101
|
+
self.visible_edges = visible_edges
|
|
102
|
+
|
|
103
|
+
# Create text object
|
|
104
|
+
self._loc = loc
|
|
105
|
+
self._text = Text(x=xy[0], y=xy[1], clip_on=False,
|
|
106
|
+
text=text, fontproperties=fontproperties,
|
|
107
|
+
horizontalalignment=loc, verticalalignment='center')
|
|
108
|
+
|
|
109
|
+
def set_transform(self, t):
|
|
110
|
+
super().set_transform(t)
|
|
111
|
+
# the text does not get the transform!
|
|
112
|
+
self.stale = True
|
|
113
|
+
|
|
114
|
+
def set_figure(self, fig):
|
|
115
|
+
super().set_figure(fig)
|
|
116
|
+
self._text.set_figure(fig)
|
|
117
|
+
|
|
118
|
+
def get_text(self):
|
|
119
|
+
"""Return the cell `.Text` instance."""
|
|
120
|
+
return self._text
|
|
121
|
+
|
|
122
|
+
def set_fontsize(self, size):
|
|
123
|
+
"""Set the text fontsize."""
|
|
124
|
+
self._text.set_fontsize(size)
|
|
125
|
+
self.stale = True
|
|
126
|
+
|
|
127
|
+
def get_fontsize(self):
|
|
128
|
+
"""Return the cell fontsize."""
|
|
129
|
+
return self._text.get_fontsize()
|
|
130
|
+
|
|
131
|
+
def auto_set_font_size(self, renderer):
|
|
132
|
+
"""Shrink font size until the text fits into the cell width."""
|
|
133
|
+
fontsize = self.get_fontsize()
|
|
134
|
+
required = self.get_required_width(renderer)
|
|
135
|
+
while fontsize > 1 and required > self.get_width():
|
|
136
|
+
fontsize -= 1
|
|
137
|
+
self.set_fontsize(fontsize)
|
|
138
|
+
required = self.get_required_width(renderer)
|
|
139
|
+
|
|
140
|
+
return fontsize
|
|
141
|
+
|
|
142
|
+
@allow_rasterization
|
|
143
|
+
def draw(self, renderer):
|
|
144
|
+
if not self.get_visible():
|
|
145
|
+
return
|
|
146
|
+
# draw the rectangle
|
|
147
|
+
super().draw(renderer)
|
|
148
|
+
# position the text
|
|
149
|
+
self._set_text_position(renderer)
|
|
150
|
+
self._text.draw(renderer)
|
|
151
|
+
self.stale = False
|
|
152
|
+
|
|
153
|
+
def _set_text_position(self, renderer):
|
|
154
|
+
"""Set text up so it is drawn in the right place."""
|
|
155
|
+
bbox = self.get_window_extent(renderer)
|
|
156
|
+
# center vertically
|
|
157
|
+
y = bbox.y0 + bbox.height / 2
|
|
158
|
+
# position horizontally
|
|
159
|
+
loc = self._text.get_horizontalalignment()
|
|
160
|
+
if loc == 'center':
|
|
161
|
+
x = bbox.x0 + bbox.width / 2
|
|
162
|
+
elif loc == 'left':
|
|
163
|
+
x = bbox.x0 + bbox.width * self.PAD
|
|
164
|
+
else: # right.
|
|
165
|
+
x = bbox.x0 + bbox.width * (1 - self.PAD)
|
|
166
|
+
self._text.set_position((x, y))
|
|
167
|
+
|
|
168
|
+
def get_text_bounds(self, renderer):
|
|
169
|
+
"""
|
|
170
|
+
Return the text bounds as *(x, y, width, height)* in table coordinates.
|
|
171
|
+
"""
|
|
172
|
+
return (self._text.get_window_extent(renderer)
|
|
173
|
+
.transformed(self.get_data_transform().inverted())
|
|
174
|
+
.bounds)
|
|
175
|
+
|
|
176
|
+
def get_required_width(self, renderer):
|
|
177
|
+
"""Return the minimal required width for the cell."""
|
|
178
|
+
l, b, w, h = self.get_text_bounds(renderer)
|
|
179
|
+
return w * (1.0 + (2.0 * self.PAD))
|
|
180
|
+
|
|
181
|
+
@_docstring.interpd
|
|
182
|
+
def set_text_props(self, **kwargs):
|
|
183
|
+
"""
|
|
184
|
+
Update the text properties.
|
|
185
|
+
|
|
186
|
+
Valid keyword arguments are:
|
|
187
|
+
|
|
188
|
+
%(Text:kwdoc)s
|
|
189
|
+
"""
|
|
190
|
+
self._text._internal_update(kwargs)
|
|
191
|
+
self.stale = True
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
def visible_edges(self):
|
|
195
|
+
"""
|
|
196
|
+
The cell edges to be drawn with a line.
|
|
197
|
+
|
|
198
|
+
Reading this property returns a substring of 'BRTL' (bottom, right,
|
|
199
|
+
top, left').
|
|
200
|
+
|
|
201
|
+
When setting this property, you can use a substring of 'BRTL' or one
|
|
202
|
+
of {'open', 'closed', 'horizontal', 'vertical'}.
|
|
203
|
+
"""
|
|
204
|
+
return self._visible_edges
|
|
205
|
+
|
|
206
|
+
@visible_edges.setter
|
|
207
|
+
def visible_edges(self, value):
|
|
208
|
+
if value is None:
|
|
209
|
+
self._visible_edges = self._edges
|
|
210
|
+
elif value in self._edge_aliases:
|
|
211
|
+
self._visible_edges = self._edge_aliases[value]
|
|
212
|
+
else:
|
|
213
|
+
if any(edge not in self._edges for edge in value):
|
|
214
|
+
raise ValueError('Invalid edge param {}, must only be one of '
|
|
215
|
+
'{} or string of {}'.format(
|
|
216
|
+
value,
|
|
217
|
+
", ".join(self._edge_aliases),
|
|
218
|
+
", ".join(self._edges)))
|
|
219
|
+
self._visible_edges = value
|
|
220
|
+
self.stale = True
|
|
221
|
+
|
|
222
|
+
def get_path(self):
|
|
223
|
+
"""Return a `.Path` for the `.visible_edges`."""
|
|
224
|
+
codes = [Path.MOVETO]
|
|
225
|
+
codes.extend(
|
|
226
|
+
Path.LINETO if edge in self._visible_edges else Path.MOVETO
|
|
227
|
+
for edge in self._edges)
|
|
228
|
+
if Path.MOVETO not in codes[1:]: # All sides are visible
|
|
229
|
+
codes[-1] = Path.CLOSEPOLY
|
|
230
|
+
return Path(
|
|
231
|
+
[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]],
|
|
232
|
+
codes,
|
|
233
|
+
readonly=True
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
CustomCell = Cell # Backcompat. alias.
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
class Table(Artist):
|
|
241
|
+
"""
|
|
242
|
+
A table of cells.
|
|
243
|
+
|
|
244
|
+
.. note::
|
|
245
|
+
|
|
246
|
+
``table()`` has some fundamental design limitations and will not be
|
|
247
|
+
developed further. If you need more functionality, consider
|
|
248
|
+
`blume <https://github.com/swfiua/blume>`__.
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
The table consists of a grid of cells, which are indexed by (row, column).
|
|
252
|
+
|
|
253
|
+
For a simple table, you'll have a full grid of cells with indices from
|
|
254
|
+
(0, 0) to (num_rows-1, num_cols-1), in which the cell (0, 0) is positioned
|
|
255
|
+
at the top left. However, you can also add cells with negative indices.
|
|
256
|
+
You don't have to add a cell to every grid position, so you can create
|
|
257
|
+
tables that have holes.
|
|
258
|
+
|
|
259
|
+
*Note*: You'll usually not create an empty table from scratch. Instead use
|
|
260
|
+
`~matplotlib.table.table` to create a table from data.
|
|
261
|
+
"""
|
|
262
|
+
codes = {'best': 0,
|
|
263
|
+
'upper right': 1, # default
|
|
264
|
+
'upper left': 2,
|
|
265
|
+
'lower left': 3,
|
|
266
|
+
'lower right': 4,
|
|
267
|
+
'center left': 5,
|
|
268
|
+
'center right': 6,
|
|
269
|
+
'lower center': 7,
|
|
270
|
+
'upper center': 8,
|
|
271
|
+
'center': 9,
|
|
272
|
+
'top right': 10,
|
|
273
|
+
'top left': 11,
|
|
274
|
+
'bottom left': 12,
|
|
275
|
+
'bottom right': 13,
|
|
276
|
+
'right': 14,
|
|
277
|
+
'left': 15,
|
|
278
|
+
'top': 16,
|
|
279
|
+
'bottom': 17,
|
|
280
|
+
}
|
|
281
|
+
"""Possible values where to place the table relative to the Axes."""
|
|
282
|
+
|
|
283
|
+
FONTSIZE = 10
|
|
284
|
+
|
|
285
|
+
AXESPAD = 0.02
|
|
286
|
+
"""The border between the Axes and the table edge in Axes units."""
|
|
287
|
+
|
|
288
|
+
def __init__(self, ax, loc=None, bbox=None, **kwargs):
|
|
289
|
+
"""
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
ax : `~matplotlib.axes.Axes`
|
|
293
|
+
The `~.axes.Axes` to plot the table into.
|
|
294
|
+
loc : str, optional
|
|
295
|
+
The position of the cell with respect to *ax*. This must be one of
|
|
296
|
+
the `~.Table.codes`.
|
|
297
|
+
bbox : `.Bbox` or [xmin, ymin, width, height], optional
|
|
298
|
+
A bounding box to draw the table into. If this is not *None*, this
|
|
299
|
+
overrides *loc*.
|
|
300
|
+
|
|
301
|
+
Other Parameters
|
|
302
|
+
----------------
|
|
303
|
+
**kwargs
|
|
304
|
+
`.Artist` properties.
|
|
305
|
+
"""
|
|
306
|
+
|
|
307
|
+
super().__init__()
|
|
308
|
+
|
|
309
|
+
if isinstance(loc, str):
|
|
310
|
+
if loc not in self.codes:
|
|
311
|
+
raise ValueError(
|
|
312
|
+
"Unrecognized location {!r}. Valid locations are\n\t{}"
|
|
313
|
+
.format(loc, '\n\t'.join(self.codes)))
|
|
314
|
+
loc = self.codes[loc]
|
|
315
|
+
self.set_figure(ax.get_figure(root=False))
|
|
316
|
+
self._axes = ax
|
|
317
|
+
self._loc = loc
|
|
318
|
+
self._bbox = bbox
|
|
319
|
+
|
|
320
|
+
# use axes coords
|
|
321
|
+
ax._unstale_viewLim()
|
|
322
|
+
self.set_transform(ax.transAxes)
|
|
323
|
+
|
|
324
|
+
self._cells = {}
|
|
325
|
+
self._edges = None
|
|
326
|
+
self._autoColumns = []
|
|
327
|
+
self._autoFontsize = True
|
|
328
|
+
self._internal_update(kwargs)
|
|
329
|
+
|
|
330
|
+
self.set_clip_on(False)
|
|
331
|
+
|
|
332
|
+
def add_cell(self, row, col, *args, **kwargs):
|
|
333
|
+
"""
|
|
334
|
+
Create a cell and add it to the table.
|
|
335
|
+
|
|
336
|
+
Parameters
|
|
337
|
+
----------
|
|
338
|
+
row : int
|
|
339
|
+
Row index.
|
|
340
|
+
col : int
|
|
341
|
+
Column index.
|
|
342
|
+
*args, **kwargs
|
|
343
|
+
All other parameters are passed on to `Cell`.
|
|
344
|
+
|
|
345
|
+
Returns
|
|
346
|
+
-------
|
|
347
|
+
`.Cell`
|
|
348
|
+
The created cell.
|
|
349
|
+
|
|
350
|
+
"""
|
|
351
|
+
xy = (0, 0)
|
|
352
|
+
cell = Cell(xy, visible_edges=self.edges, *args, **kwargs)
|
|
353
|
+
self[row, col] = cell
|
|
354
|
+
return cell
|
|
355
|
+
|
|
356
|
+
def __setitem__(self, position, cell):
|
|
357
|
+
"""
|
|
358
|
+
Set a custom cell in a given position.
|
|
359
|
+
"""
|
|
360
|
+
_api.check_isinstance(Cell, cell=cell)
|
|
361
|
+
try:
|
|
362
|
+
row, col = position[0], position[1]
|
|
363
|
+
except Exception as err:
|
|
364
|
+
raise KeyError('Only tuples length 2 are accepted as '
|
|
365
|
+
'coordinates') from err
|
|
366
|
+
cell.set_figure(self.get_figure(root=False))
|
|
367
|
+
cell.set_transform(self.get_transform())
|
|
368
|
+
cell.set_clip_on(False)
|
|
369
|
+
self._cells[row, col] = cell
|
|
370
|
+
self.stale = True
|
|
371
|
+
|
|
372
|
+
def __getitem__(self, position):
|
|
373
|
+
"""Retrieve a custom cell from a given position."""
|
|
374
|
+
return self._cells[position]
|
|
375
|
+
|
|
376
|
+
@property
|
|
377
|
+
def edges(self):
|
|
378
|
+
"""
|
|
379
|
+
The default value of `~.Cell.visible_edges` for newly added
|
|
380
|
+
cells using `.add_cell`.
|
|
381
|
+
|
|
382
|
+
Notes
|
|
383
|
+
-----
|
|
384
|
+
This setting does currently only affect newly created cells using
|
|
385
|
+
`.add_cell`.
|
|
386
|
+
|
|
387
|
+
To change existing cells, you have to set their edges explicitly::
|
|
388
|
+
|
|
389
|
+
for c in tab.get_celld().values():
|
|
390
|
+
c.visible_edges = 'horizontal'
|
|
391
|
+
|
|
392
|
+
"""
|
|
393
|
+
return self._edges
|
|
394
|
+
|
|
395
|
+
@edges.setter
|
|
396
|
+
def edges(self, value):
|
|
397
|
+
self._edges = value
|
|
398
|
+
self.stale = True
|
|
399
|
+
|
|
400
|
+
def _approx_text_height(self):
|
|
401
|
+
return (self.FONTSIZE / 72.0 * self.get_figure(root=True).dpi /
|
|
402
|
+
self._axes.bbox.height * 1.2)
|
|
403
|
+
|
|
404
|
+
@allow_rasterization
|
|
405
|
+
def draw(self, renderer):
|
|
406
|
+
# docstring inherited
|
|
407
|
+
|
|
408
|
+
# Need a renderer to do hit tests on mouseevent; assume the last one
|
|
409
|
+
# will do
|
|
410
|
+
if renderer is None:
|
|
411
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
412
|
+
if renderer is None:
|
|
413
|
+
raise RuntimeError('No renderer defined')
|
|
414
|
+
|
|
415
|
+
if not self.get_visible():
|
|
416
|
+
return
|
|
417
|
+
renderer.open_group('table', gid=self.get_gid())
|
|
418
|
+
self._update_positions(renderer)
|
|
419
|
+
|
|
420
|
+
for key in sorted(self._cells):
|
|
421
|
+
self._cells[key].draw(renderer)
|
|
422
|
+
|
|
423
|
+
renderer.close_group('table')
|
|
424
|
+
self.stale = False
|
|
425
|
+
|
|
426
|
+
def _get_grid_bbox(self, renderer):
|
|
427
|
+
"""
|
|
428
|
+
Get a bbox, in axes coordinates for the cells.
|
|
429
|
+
|
|
430
|
+
Only include those in the range (0, 0) to (maxRow, maxCol).
|
|
431
|
+
"""
|
|
432
|
+
boxes = [cell.get_window_extent(renderer)
|
|
433
|
+
for (row, col), cell in self._cells.items()
|
|
434
|
+
if row >= 0 and col >= 0]
|
|
435
|
+
bbox = Bbox.union(boxes)
|
|
436
|
+
return bbox.transformed(self.get_transform().inverted())
|
|
437
|
+
|
|
438
|
+
def contains(self, mouseevent):
|
|
439
|
+
# docstring inherited
|
|
440
|
+
if self._different_canvas(mouseevent):
|
|
441
|
+
return False, {}
|
|
442
|
+
# TODO: Return index of the cell containing the cursor so that the user
|
|
443
|
+
# doesn't have to bind to each one individually.
|
|
444
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
445
|
+
if renderer is not None:
|
|
446
|
+
boxes = [cell.get_window_extent(renderer)
|
|
447
|
+
for (row, col), cell in self._cells.items()
|
|
448
|
+
if row >= 0 and col >= 0]
|
|
449
|
+
bbox = Bbox.union(boxes)
|
|
450
|
+
return bbox.contains(mouseevent.x, mouseevent.y), {}
|
|
451
|
+
else:
|
|
452
|
+
return False, {}
|
|
453
|
+
|
|
454
|
+
def get_children(self):
|
|
455
|
+
"""Return the Artists contained by the table."""
|
|
456
|
+
return list(self._cells.values())
|
|
457
|
+
|
|
458
|
+
def get_window_extent(self, renderer=None):
|
|
459
|
+
# docstring inherited
|
|
460
|
+
if renderer is None:
|
|
461
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
462
|
+
self._update_positions(renderer)
|
|
463
|
+
boxes = [cell.get_window_extent(renderer)
|
|
464
|
+
for cell in self._cells.values()]
|
|
465
|
+
return Bbox.union(boxes)
|
|
466
|
+
|
|
467
|
+
def _do_cell_alignment(self):
|
|
468
|
+
"""
|
|
469
|
+
Calculate row heights and column widths; position cells accordingly.
|
|
470
|
+
"""
|
|
471
|
+
# Calculate row/column widths
|
|
472
|
+
widths = {}
|
|
473
|
+
heights = {}
|
|
474
|
+
for (row, col), cell in self._cells.items():
|
|
475
|
+
height = heights.setdefault(row, 0.0)
|
|
476
|
+
heights[row] = max(height, cell.get_height())
|
|
477
|
+
width = widths.setdefault(col, 0.0)
|
|
478
|
+
widths[col] = max(width, cell.get_width())
|
|
479
|
+
|
|
480
|
+
# work out left position for each column
|
|
481
|
+
xpos = 0
|
|
482
|
+
lefts = {}
|
|
483
|
+
for col in sorted(widths):
|
|
484
|
+
lefts[col] = xpos
|
|
485
|
+
xpos += widths[col]
|
|
486
|
+
|
|
487
|
+
ypos = 0
|
|
488
|
+
bottoms = {}
|
|
489
|
+
for row in sorted(heights, reverse=True):
|
|
490
|
+
bottoms[row] = ypos
|
|
491
|
+
ypos += heights[row]
|
|
492
|
+
|
|
493
|
+
# set cell positions
|
|
494
|
+
for (row, col), cell in self._cells.items():
|
|
495
|
+
cell.set_x(lefts[col])
|
|
496
|
+
cell.set_y(bottoms[row])
|
|
497
|
+
|
|
498
|
+
def auto_set_column_width(self, col):
|
|
499
|
+
"""
|
|
500
|
+
Automatically set the widths of given columns to optimal sizes.
|
|
501
|
+
|
|
502
|
+
Parameters
|
|
503
|
+
----------
|
|
504
|
+
col : int or sequence of ints
|
|
505
|
+
The indices of the columns to auto-scale.
|
|
506
|
+
"""
|
|
507
|
+
col1d = np.atleast_1d(col)
|
|
508
|
+
if not np.issubdtype(col1d.dtype, np.integer):
|
|
509
|
+
raise TypeError("col must be an int or sequence of ints.")
|
|
510
|
+
for cell in col1d:
|
|
511
|
+
self._autoColumns.append(cell)
|
|
512
|
+
|
|
513
|
+
self.stale = True
|
|
514
|
+
|
|
515
|
+
def _auto_set_column_width(self, col, renderer):
|
|
516
|
+
"""Automatically set width for column."""
|
|
517
|
+
cells = [cell for key, cell in self._cells.items() if key[1] == col]
|
|
518
|
+
max_width = max((cell.get_required_width(renderer) for cell in cells),
|
|
519
|
+
default=0)
|
|
520
|
+
for cell in cells:
|
|
521
|
+
cell.set_width(max_width)
|
|
522
|
+
|
|
523
|
+
def auto_set_font_size(self, value=True):
|
|
524
|
+
"""Automatically set font size."""
|
|
525
|
+
self._autoFontsize = value
|
|
526
|
+
self.stale = True
|
|
527
|
+
|
|
528
|
+
def _auto_set_font_size(self, renderer):
|
|
529
|
+
|
|
530
|
+
if len(self._cells) == 0:
|
|
531
|
+
return
|
|
532
|
+
fontsize = next(iter(self._cells.values())).get_fontsize()
|
|
533
|
+
cells = []
|
|
534
|
+
for key, cell in self._cells.items():
|
|
535
|
+
# ignore auto-sized columns
|
|
536
|
+
if key[1] in self._autoColumns:
|
|
537
|
+
continue
|
|
538
|
+
size = cell.auto_set_font_size(renderer)
|
|
539
|
+
fontsize = min(fontsize, size)
|
|
540
|
+
cells.append(cell)
|
|
541
|
+
|
|
542
|
+
# now set all fontsizes equal
|
|
543
|
+
for cell in self._cells.values():
|
|
544
|
+
cell.set_fontsize(fontsize)
|
|
545
|
+
|
|
546
|
+
def scale(self, xscale, yscale):
|
|
547
|
+
"""Scale column widths by *xscale* and row heights by *yscale*."""
|
|
548
|
+
for c in self._cells.values():
|
|
549
|
+
c.set_width(c.get_width() * xscale)
|
|
550
|
+
c.set_height(c.get_height() * yscale)
|
|
551
|
+
|
|
552
|
+
def set_fontsize(self, size):
|
|
553
|
+
"""
|
|
554
|
+
Set the font size, in points, of the cell text.
|
|
555
|
+
|
|
556
|
+
Parameters
|
|
557
|
+
----------
|
|
558
|
+
size : float
|
|
559
|
+
|
|
560
|
+
Notes
|
|
561
|
+
-----
|
|
562
|
+
As long as auto font size has not been disabled, the value will be
|
|
563
|
+
clipped such that the text fits horizontally into the cell.
|
|
564
|
+
|
|
565
|
+
You can disable this behavior using `.auto_set_font_size`.
|
|
566
|
+
|
|
567
|
+
>>> the_table.auto_set_font_size(False)
|
|
568
|
+
>>> the_table.set_fontsize(20)
|
|
569
|
+
|
|
570
|
+
However, there is no automatic scaling of the row height so that the
|
|
571
|
+
text may exceed the cell boundary.
|
|
572
|
+
"""
|
|
573
|
+
for cell in self._cells.values():
|
|
574
|
+
cell.set_fontsize(size)
|
|
575
|
+
self.stale = True
|
|
576
|
+
|
|
577
|
+
def _offset(self, ox, oy):
|
|
578
|
+
"""Move all the artists by ox, oy (axes coords)."""
|
|
579
|
+
for c in self._cells.values():
|
|
580
|
+
x, y = c.get_x(), c.get_y()
|
|
581
|
+
c.set_x(x + ox)
|
|
582
|
+
c.set_y(y + oy)
|
|
583
|
+
|
|
584
|
+
def _update_positions(self, renderer):
|
|
585
|
+
# called from renderer to allow more precise estimates of
|
|
586
|
+
# widths and heights with get_window_extent
|
|
587
|
+
|
|
588
|
+
# Do any auto width setting
|
|
589
|
+
for col in self._autoColumns:
|
|
590
|
+
self._auto_set_column_width(col, renderer)
|
|
591
|
+
|
|
592
|
+
if self._autoFontsize:
|
|
593
|
+
self._auto_set_font_size(renderer)
|
|
594
|
+
|
|
595
|
+
# Align all the cells
|
|
596
|
+
self._do_cell_alignment()
|
|
597
|
+
|
|
598
|
+
bbox = self._get_grid_bbox(renderer)
|
|
599
|
+
l, b, w, h = bbox.bounds
|
|
600
|
+
|
|
601
|
+
if self._bbox is not None:
|
|
602
|
+
# Position according to bbox
|
|
603
|
+
if isinstance(self._bbox, Bbox):
|
|
604
|
+
rl, rb, rw, rh = self._bbox.bounds
|
|
605
|
+
else:
|
|
606
|
+
rl, rb, rw, rh = self._bbox
|
|
607
|
+
self.scale(rw / w, rh / h)
|
|
608
|
+
ox = rl - l
|
|
609
|
+
oy = rb - b
|
|
610
|
+
self._do_cell_alignment()
|
|
611
|
+
else:
|
|
612
|
+
# Position using loc
|
|
613
|
+
(BEST, UR, UL, LL, LR, CL, CR, LC, UC, C,
|
|
614
|
+
TR, TL, BL, BR, R, L, T, B) = range(len(self.codes))
|
|
615
|
+
# defaults for center
|
|
616
|
+
ox = (0.5 - w / 2) - l
|
|
617
|
+
oy = (0.5 - h / 2) - b
|
|
618
|
+
if self._loc in (UL, LL, CL): # left
|
|
619
|
+
ox = self.AXESPAD - l
|
|
620
|
+
if self._loc in (BEST, UR, LR, R, CR): # right
|
|
621
|
+
ox = 1 - (l + w + self.AXESPAD)
|
|
622
|
+
if self._loc in (BEST, UR, UL, UC): # upper
|
|
623
|
+
oy = 1 - (b + h + self.AXESPAD)
|
|
624
|
+
if self._loc in (LL, LR, LC): # lower
|
|
625
|
+
oy = self.AXESPAD - b
|
|
626
|
+
if self._loc in (LC, UC, C): # center x
|
|
627
|
+
ox = (0.5 - w / 2) - l
|
|
628
|
+
if self._loc in (CL, CR, C): # center y
|
|
629
|
+
oy = (0.5 - h / 2) - b
|
|
630
|
+
|
|
631
|
+
if self._loc in (TL, BL, L): # out left
|
|
632
|
+
ox = - (l + w)
|
|
633
|
+
if self._loc in (TR, BR, R): # out right
|
|
634
|
+
ox = 1.0 - l
|
|
635
|
+
if self._loc in (TR, TL, T): # out top
|
|
636
|
+
oy = 1.0 - b
|
|
637
|
+
if self._loc in (BL, BR, B): # out bottom
|
|
638
|
+
oy = - (b + h)
|
|
639
|
+
|
|
640
|
+
self._offset(ox, oy)
|
|
641
|
+
|
|
642
|
+
def get_celld(self):
|
|
643
|
+
r"""
|
|
644
|
+
Return a dict of cells in the table mapping *(row, column)* to
|
|
645
|
+
`.Cell`\s.
|
|
646
|
+
|
|
647
|
+
Notes
|
|
648
|
+
-----
|
|
649
|
+
You can also directly index into the Table object to access individual
|
|
650
|
+
cells::
|
|
651
|
+
|
|
652
|
+
cell = table[row, col]
|
|
653
|
+
|
|
654
|
+
"""
|
|
655
|
+
return self._cells
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
@_docstring.interpd
|
|
659
|
+
def table(ax,
|
|
660
|
+
cellText=None, cellColours=None,
|
|
661
|
+
cellLoc='right', colWidths=None,
|
|
662
|
+
rowLabels=None, rowColours=None, rowLoc='left',
|
|
663
|
+
colLabels=None, colColours=None, colLoc='center',
|
|
664
|
+
loc='bottom', bbox=None, edges='closed',
|
|
665
|
+
**kwargs):
|
|
666
|
+
"""
|
|
667
|
+
Add a table to an `~.axes.Axes`.
|
|
668
|
+
|
|
669
|
+
.. note::
|
|
670
|
+
|
|
671
|
+
``table()`` has some fundamental design limitations and will not be
|
|
672
|
+
developed further. If you need more functionality, consider
|
|
673
|
+
`blume <https://github.com/swfiua/blume>`__.
|
|
674
|
+
|
|
675
|
+
At least one of *cellText* or *cellColours* must be specified. These
|
|
676
|
+
parameters must be 2D lists, in which the outer lists define the rows and
|
|
677
|
+
the inner list define the column values per row. Each row must have the
|
|
678
|
+
same number of elements.
|
|
679
|
+
|
|
680
|
+
The table can optionally have row and column headers, which are configured
|
|
681
|
+
using *rowLabels*, *rowColours*, *rowLoc* and *colLabels*, *colColours*,
|
|
682
|
+
*colLoc* respectively.
|
|
683
|
+
|
|
684
|
+
For finer grained control over tables, use the `.Table` class and add it to
|
|
685
|
+
the Axes with `.Axes.add_table`.
|
|
686
|
+
|
|
687
|
+
Parameters
|
|
688
|
+
----------
|
|
689
|
+
cellText : 2D list of str or pandas.DataFrame, optional
|
|
690
|
+
The texts to place into the table cells.
|
|
691
|
+
|
|
692
|
+
*Note*: Line breaks in the strings are currently not accounted for and
|
|
693
|
+
will result in the text exceeding the cell boundaries.
|
|
694
|
+
|
|
695
|
+
cellColours : 2D list of :mpltype:`color`, optional
|
|
696
|
+
The background colors of the cells.
|
|
697
|
+
|
|
698
|
+
cellLoc : {'right', 'center', 'left'}
|
|
699
|
+
The alignment of the text within the cells.
|
|
700
|
+
|
|
701
|
+
colWidths : list of float, optional
|
|
702
|
+
The column widths in units of the axes. If not given, all columns will
|
|
703
|
+
have a width of *1 / ncols*.
|
|
704
|
+
|
|
705
|
+
rowLabels : list of str, optional
|
|
706
|
+
The text of the row header cells.
|
|
707
|
+
|
|
708
|
+
rowColours : list of :mpltype:`color`, optional
|
|
709
|
+
The colors of the row header cells.
|
|
710
|
+
|
|
711
|
+
rowLoc : {'left', 'center', 'right'}
|
|
712
|
+
The text alignment of the row header cells.
|
|
713
|
+
|
|
714
|
+
colLabels : list of str, optional
|
|
715
|
+
The text of the column header cells.
|
|
716
|
+
|
|
717
|
+
colColours : list of :mpltype:`color`, optional
|
|
718
|
+
The colors of the column header cells.
|
|
719
|
+
|
|
720
|
+
colLoc : {'center', 'left', 'right'}
|
|
721
|
+
The text alignment of the column header cells.
|
|
722
|
+
|
|
723
|
+
loc : str, default: 'bottom'
|
|
724
|
+
The position of the cell with respect to *ax*. This must be one of
|
|
725
|
+
the `~.Table.codes`.
|
|
726
|
+
|
|
727
|
+
bbox : `.Bbox` or [xmin, ymin, width, height], optional
|
|
728
|
+
A bounding box to draw the table into. If this is not *None*, this
|
|
729
|
+
overrides *loc*.
|
|
730
|
+
|
|
731
|
+
edges : {'closed', 'open', 'horizontal', 'vertical'} or substring of 'BRTL'
|
|
732
|
+
The cell edges to be drawn with a line. See also
|
|
733
|
+
`~.Cell.visible_edges`.
|
|
734
|
+
|
|
735
|
+
Returns
|
|
736
|
+
-------
|
|
737
|
+
`~matplotlib.table.Table`
|
|
738
|
+
The created table.
|
|
739
|
+
|
|
740
|
+
Other Parameters
|
|
741
|
+
----------------
|
|
742
|
+
**kwargs
|
|
743
|
+
`.Table` properties.
|
|
744
|
+
|
|
745
|
+
%(Table:kwdoc)s
|
|
746
|
+
"""
|
|
747
|
+
|
|
748
|
+
if cellColours is None and cellText is None:
|
|
749
|
+
raise ValueError('At least one argument from "cellColours" or '
|
|
750
|
+
'"cellText" must be provided to create a table.')
|
|
751
|
+
|
|
752
|
+
# Check we have some cellText
|
|
753
|
+
if cellText is None:
|
|
754
|
+
# assume just colours are needed
|
|
755
|
+
rows = len(cellColours)
|
|
756
|
+
cols = len(cellColours[0])
|
|
757
|
+
cellText = [[''] * cols] * rows
|
|
758
|
+
|
|
759
|
+
# Check if we have a Pandas DataFrame
|
|
760
|
+
if _is_pandas_dataframe(cellText):
|
|
761
|
+
# if rowLabels/colLabels are empty, use DataFrame entries.
|
|
762
|
+
# Otherwise, throw an error.
|
|
763
|
+
if rowLabels is None:
|
|
764
|
+
rowLabels = cellText.index
|
|
765
|
+
else:
|
|
766
|
+
raise ValueError("rowLabels cannot be used alongside Pandas DataFrame")
|
|
767
|
+
if colLabels is None:
|
|
768
|
+
colLabels = cellText.columns
|
|
769
|
+
else:
|
|
770
|
+
raise ValueError("colLabels cannot be used alongside Pandas DataFrame")
|
|
771
|
+
# Update cellText with only values
|
|
772
|
+
cellText = cellText.values
|
|
773
|
+
|
|
774
|
+
rows = len(cellText)
|
|
775
|
+
cols = len(cellText[0])
|
|
776
|
+
for row in cellText:
|
|
777
|
+
if len(row) != cols:
|
|
778
|
+
raise ValueError(f"Each row in 'cellText' must have {cols} "
|
|
779
|
+
"columns")
|
|
780
|
+
|
|
781
|
+
if cellColours is not None:
|
|
782
|
+
if len(cellColours) != rows:
|
|
783
|
+
raise ValueError(f"'cellColours' must have {rows} rows")
|
|
784
|
+
for row in cellColours:
|
|
785
|
+
if len(row) != cols:
|
|
786
|
+
raise ValueError("Each row in 'cellColours' must have "
|
|
787
|
+
f"{cols} columns")
|
|
788
|
+
else:
|
|
789
|
+
cellColours = ['w' * cols] * rows
|
|
790
|
+
|
|
791
|
+
# Set colwidths if not given
|
|
792
|
+
if colWidths is None:
|
|
793
|
+
colWidths = [1.0 / cols] * cols
|
|
794
|
+
|
|
795
|
+
# Fill in missing information for column
|
|
796
|
+
# and row labels
|
|
797
|
+
rowLabelWidth = 0
|
|
798
|
+
if rowLabels is None:
|
|
799
|
+
if rowColours is not None:
|
|
800
|
+
rowLabels = [''] * rows
|
|
801
|
+
rowLabelWidth = colWidths[0]
|
|
802
|
+
elif rowColours is None:
|
|
803
|
+
rowColours = 'w' * rows
|
|
804
|
+
|
|
805
|
+
if rowLabels is not None:
|
|
806
|
+
if len(rowLabels) != rows:
|
|
807
|
+
raise ValueError(f"'rowLabels' must be of length {rows}")
|
|
808
|
+
|
|
809
|
+
# If we have column labels, need to shift
|
|
810
|
+
# the text and colour arrays down 1 row
|
|
811
|
+
offset = 1
|
|
812
|
+
if colLabels is None:
|
|
813
|
+
if colColours is not None:
|
|
814
|
+
colLabels = [''] * cols
|
|
815
|
+
else:
|
|
816
|
+
offset = 0
|
|
817
|
+
elif colColours is None:
|
|
818
|
+
colColours = 'w' * cols
|
|
819
|
+
|
|
820
|
+
# Set up cell colours if not given
|
|
821
|
+
if cellColours is None:
|
|
822
|
+
cellColours = ['w' * cols] * rows
|
|
823
|
+
|
|
824
|
+
# Now create the table
|
|
825
|
+
table = Table(ax, loc, bbox, **kwargs)
|
|
826
|
+
table.edges = edges
|
|
827
|
+
height = table._approx_text_height()
|
|
828
|
+
|
|
829
|
+
# Add the cells
|
|
830
|
+
for row in range(rows):
|
|
831
|
+
for col in range(cols):
|
|
832
|
+
table.add_cell(row + offset, col,
|
|
833
|
+
width=colWidths[col], height=height,
|
|
834
|
+
text=cellText[row][col],
|
|
835
|
+
facecolor=cellColours[row][col],
|
|
836
|
+
loc=cellLoc)
|
|
837
|
+
# Do column labels
|
|
838
|
+
if colLabels is not None:
|
|
839
|
+
for col in range(cols):
|
|
840
|
+
table.add_cell(0, col,
|
|
841
|
+
width=colWidths[col], height=height,
|
|
842
|
+
text=colLabels[col], facecolor=colColours[col],
|
|
843
|
+
loc=colLoc)
|
|
844
|
+
|
|
845
|
+
# Do row labels
|
|
846
|
+
if rowLabels is not None:
|
|
847
|
+
for row in range(rows):
|
|
848
|
+
table.add_cell(row + offset, -1,
|
|
849
|
+
width=rowLabelWidth or 1e-15, height=height,
|
|
850
|
+
text=rowLabels[row], facecolor=rowColours[row],
|
|
851
|
+
loc=rowLoc)
|
|
852
|
+
if rowLabelWidth == 0:
|
|
853
|
+
table.auto_set_column_width(-1)
|
|
854
|
+
|
|
855
|
+
# set_fontsize is only effective after cells are added
|
|
856
|
+
if "fontsize" in kwargs:
|
|
857
|
+
table.set_fontsize(kwargs["fontsize"])
|
|
858
|
+
|
|
859
|
+
ax.add_table(table)
|
|
860
|
+
return table
|