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
|
@@ -0,0 +1,1148 @@
|
|
|
1
|
+
# Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
|
|
2
|
+
"""
|
|
3
|
+
The :mod:`.axis_artist` module implements custom artists to draw axis elements
|
|
4
|
+
(axis lines and labels, tick lines and labels, grid lines).
|
|
5
|
+
|
|
6
|
+
Axis lines and labels and tick lines and labels are managed by the `AxisArtist`
|
|
7
|
+
class; grid lines are managed by the `GridlinesCollection` class.
|
|
8
|
+
|
|
9
|
+
There is one `AxisArtist` per Axis; it can be accessed through
|
|
10
|
+
the ``axis`` dictionary of the parent Axes (which should be a
|
|
11
|
+
`~mpl_toolkits.axisartist.axislines.Axes`), e.g. ``ax.axis["bottom"]``.
|
|
12
|
+
|
|
13
|
+
Children of the AxisArtist are accessed as attributes: ``.line`` and ``.label``
|
|
14
|
+
for the axis line and label, ``.major_ticks``, ``.major_ticklabels``,
|
|
15
|
+
``.minor_ticks``, ``.minor_ticklabels`` for the tick lines and labels (e.g.
|
|
16
|
+
``ax.axis["bottom"].line``).
|
|
17
|
+
|
|
18
|
+
Children properties (colors, fonts, line widths, etc.) can be set using
|
|
19
|
+
setters, e.g. ::
|
|
20
|
+
|
|
21
|
+
# Make the major ticks of the bottom axis red.
|
|
22
|
+
ax.axis["bottom"].major_ticks.set_color("red")
|
|
23
|
+
|
|
24
|
+
However, things like the locations of ticks, and their ticklabels need to be
|
|
25
|
+
changed from the side of the grid_helper.
|
|
26
|
+
|
|
27
|
+
axis_direction
|
|
28
|
+
--------------
|
|
29
|
+
|
|
30
|
+
`AxisArtist`, `AxisLabel`, `TickLabels` have an *axis_direction* attribute,
|
|
31
|
+
which adjusts the location, angle, etc. The *axis_direction* must be one of
|
|
32
|
+
"left", "right", "bottom", "top", and follows the Matplotlib convention for
|
|
33
|
+
rectangular axis.
|
|
34
|
+
|
|
35
|
+
For example, for the *bottom* axis (the left and right is relative to the
|
|
36
|
+
direction of the increasing coordinate),
|
|
37
|
+
|
|
38
|
+
* ticklabels and axislabel are on the right
|
|
39
|
+
* ticklabels and axislabel have text angle of 0
|
|
40
|
+
* ticklabels are baseline, center-aligned
|
|
41
|
+
* axislabel is top, center-aligned
|
|
42
|
+
|
|
43
|
+
The text angles are actually relative to (90 + angle of the direction to the
|
|
44
|
+
ticklabel), which gives 0 for bottom axis.
|
|
45
|
+
|
|
46
|
+
=================== ====== ======== ====== ========
|
|
47
|
+
Property left bottom right top
|
|
48
|
+
=================== ====== ======== ====== ========
|
|
49
|
+
ticklabel location left right right left
|
|
50
|
+
axislabel location left right right left
|
|
51
|
+
ticklabel angle 90 0 -90 180
|
|
52
|
+
axislabel angle 180 0 0 180
|
|
53
|
+
ticklabel va center baseline center baseline
|
|
54
|
+
axislabel va center top center bottom
|
|
55
|
+
ticklabel ha right center right center
|
|
56
|
+
axislabel ha right center right center
|
|
57
|
+
=================== ====== ======== ====== ========
|
|
58
|
+
|
|
59
|
+
Tick orientation is controlled by :rc:`xtick.direction` and
|
|
60
|
+
:rc:`ytick.direction`; they can be manually adjusted using ::
|
|
61
|
+
|
|
62
|
+
ax.axis["bottom"].major_ticks.set_tick_direction("in") # or "out", "inout"
|
|
63
|
+
|
|
64
|
+
The following attributes can be customized (use the ``set_xxx`` methods):
|
|
65
|
+
|
|
66
|
+
* `Ticks`: ticksize, tick_direction
|
|
67
|
+
* `TickLabels`: pad
|
|
68
|
+
* `AxisLabel`: pad
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
# FIXME :
|
|
72
|
+
# angles are given in data coordinate - need to convert it to canvas coordinate
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
from operator import methodcaller
|
|
76
|
+
|
|
77
|
+
import numpy as np
|
|
78
|
+
|
|
79
|
+
import matplotlib_rs as mpl
|
|
80
|
+
from matplotlib_rs import _api, cbook
|
|
81
|
+
import matplotlib_rs.artist as martist
|
|
82
|
+
import matplotlib_rs.colors as mcolors
|
|
83
|
+
import matplotlib_rs.text as mtext
|
|
84
|
+
from matplotlib_rs.collections import LineCollection
|
|
85
|
+
from matplotlib_rs.lines import Line2D
|
|
86
|
+
from matplotlib_rs.patches import PathPatch
|
|
87
|
+
from matplotlib_rs.path import Path
|
|
88
|
+
from matplotlib_rs.transforms import (
|
|
89
|
+
Affine2D, Bbox, IdentityTransform, ScaledTranslation)
|
|
90
|
+
|
|
91
|
+
from .axisline_style import AxislineStyle
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class AttributeCopier:
|
|
95
|
+
def get_ref_artist(self):
|
|
96
|
+
"""
|
|
97
|
+
Return the underlying artist that actually defines some properties
|
|
98
|
+
(e.g., color) of this artist.
|
|
99
|
+
"""
|
|
100
|
+
raise RuntimeError("get_ref_artist must overridden")
|
|
101
|
+
|
|
102
|
+
def get_attribute_from_ref_artist(self, attr_name):
|
|
103
|
+
getter = methodcaller("get_" + attr_name)
|
|
104
|
+
prop = getter(super())
|
|
105
|
+
return getter(self.get_ref_artist()) if prop == "auto" else prop
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class Ticks(AttributeCopier, Line2D):
|
|
109
|
+
"""
|
|
110
|
+
Ticks are derived from `.Line2D`, and note that ticks themselves
|
|
111
|
+
are markers. Thus, you should use set_mec, set_mew, etc.
|
|
112
|
+
|
|
113
|
+
To change the tick size (length), use `set_ticksize`.
|
|
114
|
+
To change the direction of the ticks, use ``set_tick_direction("in")`` (or
|
|
115
|
+
"out", or "inout").
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
locs_angles_labels = _api.deprecated("3.11")(property(lambda self: []))
|
|
119
|
+
|
|
120
|
+
@_api.delete_parameter("3.11", "tick_out", alternative="tick_direction")
|
|
121
|
+
def __init__(self, ticksize, tick_out=False, *, axis=None, **kwargs):
|
|
122
|
+
self._ticksize = ticksize
|
|
123
|
+
self.set_tick_out(tick_out)
|
|
124
|
+
|
|
125
|
+
self._axis = axis
|
|
126
|
+
if self._axis is not None:
|
|
127
|
+
if "color" not in kwargs:
|
|
128
|
+
kwargs["color"] = "auto"
|
|
129
|
+
if "mew" not in kwargs and "markeredgewidth" not in kwargs:
|
|
130
|
+
kwargs["markeredgewidth"] = "auto"
|
|
131
|
+
|
|
132
|
+
Line2D.__init__(self, [0.], [0.], **kwargs)
|
|
133
|
+
self.set_snap(True)
|
|
134
|
+
|
|
135
|
+
def get_ref_artist(self):
|
|
136
|
+
# docstring inherited
|
|
137
|
+
return self._axis.majorTicks[0].tick1line
|
|
138
|
+
|
|
139
|
+
def set_color(self, color):
|
|
140
|
+
# docstring inherited
|
|
141
|
+
# Unlike the base Line2D.set_color, this also supports "auto".
|
|
142
|
+
if not cbook._str_equal(color, "auto"):
|
|
143
|
+
mcolors._check_color_like(color=color)
|
|
144
|
+
self._color = color
|
|
145
|
+
self.stale = True
|
|
146
|
+
|
|
147
|
+
def get_color(self):
|
|
148
|
+
return self.get_attribute_from_ref_artist("color")
|
|
149
|
+
|
|
150
|
+
def get_markeredgecolor(self):
|
|
151
|
+
return self.get_attribute_from_ref_artist("markeredgecolor")
|
|
152
|
+
|
|
153
|
+
def get_markeredgewidth(self):
|
|
154
|
+
return self.get_attribute_from_ref_artist("markeredgewidth")
|
|
155
|
+
|
|
156
|
+
def set_tick_direction(self, direction):
|
|
157
|
+
_api.check_in_list(["in", "out", "inout"], direction=direction)
|
|
158
|
+
self._tick_dir = direction
|
|
159
|
+
|
|
160
|
+
def get_tick_direction(self):
|
|
161
|
+
return self._tick_dir
|
|
162
|
+
|
|
163
|
+
def set_tick_out(self, b):
|
|
164
|
+
"""
|
|
165
|
+
Set whether ticks are drawn inside or outside the axes.
|
|
166
|
+
|
|
167
|
+
.. admonition:: Discouraged
|
|
168
|
+
Consider using the more general method `.set_tick_direction` instead.
|
|
169
|
+
"""
|
|
170
|
+
self._tick_dir = "out" if b else "in"
|
|
171
|
+
|
|
172
|
+
@_api.deprecated("3.11", alternative="get_tick_direction")
|
|
173
|
+
def get_tick_out(self):
|
|
174
|
+
"""Return whether ticks are drawn inside or outside the axes."""
|
|
175
|
+
if self._tick_dir == "in":
|
|
176
|
+
return False
|
|
177
|
+
elif self._tick_dir == "out":
|
|
178
|
+
return True
|
|
179
|
+
else:
|
|
180
|
+
raise ValueError(
|
|
181
|
+
f"Tick direction ({self._tick_dir!r}) not supported by get_tick_out, "
|
|
182
|
+
f"use get_tick_direction instead")
|
|
183
|
+
|
|
184
|
+
def set_ticksize(self, ticksize):
|
|
185
|
+
"""Set length of the ticks in points."""
|
|
186
|
+
self._ticksize = ticksize
|
|
187
|
+
|
|
188
|
+
def get_ticksize(self):
|
|
189
|
+
"""Return length of the ticks in points."""
|
|
190
|
+
return self._ticksize
|
|
191
|
+
|
|
192
|
+
def set_locs_angles(self, locs_angles):
|
|
193
|
+
self.locs_angles = locs_angles
|
|
194
|
+
|
|
195
|
+
_tick_paths = {
|
|
196
|
+
"in": Path([[0, 0], [+1, 0]]),
|
|
197
|
+
"inout": Path([[-1/2, 0.], [+1/2, 0]]),
|
|
198
|
+
"out": Path([[-1, 0], [0, 0]]),
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
def draw(self, renderer):
|
|
202
|
+
if not self.get_visible():
|
|
203
|
+
return
|
|
204
|
+
|
|
205
|
+
gc = renderer.new_gc()
|
|
206
|
+
edgecolor = mcolors.to_rgba(self.get_markeredgecolor())
|
|
207
|
+
gc.set_foreground(edgecolor, isRGBA=True)
|
|
208
|
+
gc.set_linewidth(self.get_markeredgewidth())
|
|
209
|
+
gc.set_alpha(self._alpha)
|
|
210
|
+
|
|
211
|
+
tickvert_path = self._tick_paths[self._tick_dir]
|
|
212
|
+
path_trans = self.get_transform()
|
|
213
|
+
marker_transform = (Affine2D()
|
|
214
|
+
.scale(renderer.points_to_pixels(self._ticksize)))
|
|
215
|
+
|
|
216
|
+
for loc, angle in self.locs_angles:
|
|
217
|
+
locs = path_trans.transform_non_affine(np.array([loc]))
|
|
218
|
+
if self.axes and not self.axes.viewLim.contains(*locs[0]):
|
|
219
|
+
continue
|
|
220
|
+
renderer.draw_markers(
|
|
221
|
+
gc, tickvert_path,
|
|
222
|
+
marker_transform + Affine2D().rotate_deg(angle),
|
|
223
|
+
Path(locs), path_trans.get_affine())
|
|
224
|
+
|
|
225
|
+
gc.restore()
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class LabelBase(mtext.Text):
|
|
229
|
+
"""
|
|
230
|
+
A base class for `.AxisLabel` and `.TickLabels`. The position and
|
|
231
|
+
angle of the text are calculated by the offset_ref_angle,
|
|
232
|
+
text_ref_angle, and offset_radius attributes.
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
locs_angles_labels = _api.deprecated("3.11")(property(lambda self: []))
|
|
236
|
+
|
|
237
|
+
def __init__(self, *args, **kwargs):
|
|
238
|
+
self._ref_angle = 0
|
|
239
|
+
self._offset_radius = 0.
|
|
240
|
+
|
|
241
|
+
super().__init__(*args, **kwargs)
|
|
242
|
+
|
|
243
|
+
self.set_rotation_mode("anchor")
|
|
244
|
+
self._text_follow_ref_angle = True
|
|
245
|
+
|
|
246
|
+
@property
|
|
247
|
+
def _text_ref_angle(self):
|
|
248
|
+
if self._text_follow_ref_angle:
|
|
249
|
+
return self._ref_angle + 90
|
|
250
|
+
else:
|
|
251
|
+
return 0
|
|
252
|
+
|
|
253
|
+
@property
|
|
254
|
+
def _offset_ref_angle(self):
|
|
255
|
+
return self._ref_angle
|
|
256
|
+
|
|
257
|
+
_get_opposite_direction = {"left": "right",
|
|
258
|
+
"right": "left",
|
|
259
|
+
"top": "bottom",
|
|
260
|
+
"bottom": "top"}.__getitem__
|
|
261
|
+
|
|
262
|
+
def draw(self, renderer):
|
|
263
|
+
if not self.get_visible():
|
|
264
|
+
return
|
|
265
|
+
|
|
266
|
+
# save original and adjust some properties
|
|
267
|
+
tr = self.get_transform()
|
|
268
|
+
angle_orig = self.get_rotation()
|
|
269
|
+
theta = np.deg2rad(self._offset_ref_angle)
|
|
270
|
+
dd = self._offset_radius
|
|
271
|
+
dx, dy = dd * np.cos(theta), dd * np.sin(theta)
|
|
272
|
+
|
|
273
|
+
self.set_transform(tr + Affine2D().translate(dx, dy))
|
|
274
|
+
self.set_rotation(self._text_ref_angle + angle_orig)
|
|
275
|
+
super().draw(renderer)
|
|
276
|
+
# restore original properties
|
|
277
|
+
self.set_transform(tr)
|
|
278
|
+
self.set_rotation(angle_orig)
|
|
279
|
+
|
|
280
|
+
def get_window_extent(self, renderer=None):
|
|
281
|
+
if renderer is None:
|
|
282
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
283
|
+
|
|
284
|
+
# save original and adjust some properties
|
|
285
|
+
tr = self.get_transform()
|
|
286
|
+
angle_orig = self.get_rotation()
|
|
287
|
+
theta = np.deg2rad(self._offset_ref_angle)
|
|
288
|
+
dd = self._offset_radius
|
|
289
|
+
dx, dy = dd * np.cos(theta), dd * np.sin(theta)
|
|
290
|
+
|
|
291
|
+
self.set_transform(tr + Affine2D().translate(dx, dy))
|
|
292
|
+
self.set_rotation(self._text_ref_angle + angle_orig)
|
|
293
|
+
bbox = super().get_window_extent(renderer).frozen()
|
|
294
|
+
# restore original properties
|
|
295
|
+
self.set_transform(tr)
|
|
296
|
+
self.set_rotation(angle_orig)
|
|
297
|
+
|
|
298
|
+
return bbox
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class AxisLabel(AttributeCopier, LabelBase):
|
|
302
|
+
"""
|
|
303
|
+
Axis label. Derived from `.Text`. The position of the text is updated
|
|
304
|
+
in the fly, so changing text position has no effect. Otherwise, the
|
|
305
|
+
properties can be changed as a normal `.Text`.
|
|
306
|
+
|
|
307
|
+
To change the pad between tick labels and axis label, use `set_pad`.
|
|
308
|
+
"""
|
|
309
|
+
|
|
310
|
+
def __init__(self, *args, axis_direction="bottom", axis=None, **kwargs):
|
|
311
|
+
self._axis = axis
|
|
312
|
+
self._pad = 5
|
|
313
|
+
self._external_pad = 0 # in pixels
|
|
314
|
+
LabelBase.__init__(self, *args, **kwargs)
|
|
315
|
+
self.set_axis_direction(axis_direction)
|
|
316
|
+
|
|
317
|
+
def set_pad(self, pad):
|
|
318
|
+
"""
|
|
319
|
+
Set the internal pad in points.
|
|
320
|
+
|
|
321
|
+
The actual pad will be the sum of the internal pad and the
|
|
322
|
+
external pad (the latter is set automatically by the `.AxisArtist`).
|
|
323
|
+
|
|
324
|
+
Parameters
|
|
325
|
+
----------
|
|
326
|
+
pad : float
|
|
327
|
+
The internal pad in points.
|
|
328
|
+
"""
|
|
329
|
+
self._pad = pad
|
|
330
|
+
|
|
331
|
+
def get_pad(self):
|
|
332
|
+
"""
|
|
333
|
+
Return the internal pad in points.
|
|
334
|
+
|
|
335
|
+
See `.set_pad` for more details.
|
|
336
|
+
"""
|
|
337
|
+
return self._pad
|
|
338
|
+
|
|
339
|
+
def get_ref_artist(self):
|
|
340
|
+
# docstring inherited
|
|
341
|
+
return self._axis.label
|
|
342
|
+
|
|
343
|
+
def get_text(self):
|
|
344
|
+
# docstring inherited
|
|
345
|
+
t = super().get_text()
|
|
346
|
+
if t == "__from_axes__":
|
|
347
|
+
return self._axis.label.get_text()
|
|
348
|
+
return self._text
|
|
349
|
+
|
|
350
|
+
_default_alignments = dict(left=("bottom", "center"),
|
|
351
|
+
right=("top", "center"),
|
|
352
|
+
bottom=("top", "center"),
|
|
353
|
+
top=("bottom", "center"))
|
|
354
|
+
|
|
355
|
+
def set_default_alignment(self, d):
|
|
356
|
+
"""
|
|
357
|
+
Set the default alignment. See `set_axis_direction` for details.
|
|
358
|
+
|
|
359
|
+
Parameters
|
|
360
|
+
----------
|
|
361
|
+
d : {"left", "bottom", "right", "top"}
|
|
362
|
+
"""
|
|
363
|
+
va, ha = _api.getitem_checked(self._default_alignments, d=d)
|
|
364
|
+
self.set_va(va)
|
|
365
|
+
self.set_ha(ha)
|
|
366
|
+
|
|
367
|
+
_default_angles = dict(left=180,
|
|
368
|
+
right=0,
|
|
369
|
+
bottom=0,
|
|
370
|
+
top=180)
|
|
371
|
+
|
|
372
|
+
def set_default_angle(self, d):
|
|
373
|
+
"""
|
|
374
|
+
Set the default angle. See `set_axis_direction` for details.
|
|
375
|
+
|
|
376
|
+
Parameters
|
|
377
|
+
----------
|
|
378
|
+
d : {"left", "bottom", "right", "top"}
|
|
379
|
+
"""
|
|
380
|
+
self.set_rotation(_api.getitem_checked(self._default_angles, d=d))
|
|
381
|
+
|
|
382
|
+
def set_axis_direction(self, d):
|
|
383
|
+
"""
|
|
384
|
+
Adjust the text angle and text alignment of axis label
|
|
385
|
+
according to the matplotlib convention.
|
|
386
|
+
|
|
387
|
+
===================== ========== ========= ========== ==========
|
|
388
|
+
Property left bottom right top
|
|
389
|
+
===================== ========== ========= ========== ==========
|
|
390
|
+
axislabel angle 180 0 0 180
|
|
391
|
+
axislabel va center top center bottom
|
|
392
|
+
axislabel ha right center right center
|
|
393
|
+
===================== ========== ========= ========== ==========
|
|
394
|
+
|
|
395
|
+
Note that the text angles are actually relative to (90 + angle
|
|
396
|
+
of the direction to the ticklabel), which gives 0 for bottom
|
|
397
|
+
axis.
|
|
398
|
+
|
|
399
|
+
Parameters
|
|
400
|
+
----------
|
|
401
|
+
d : {"left", "bottom", "right", "top"}
|
|
402
|
+
"""
|
|
403
|
+
self.set_default_alignment(d)
|
|
404
|
+
self.set_default_angle(d)
|
|
405
|
+
|
|
406
|
+
def get_color(self):
|
|
407
|
+
return self.get_attribute_from_ref_artist("color")
|
|
408
|
+
|
|
409
|
+
def draw(self, renderer):
|
|
410
|
+
if not self.get_visible():
|
|
411
|
+
return
|
|
412
|
+
|
|
413
|
+
self._offset_radius = \
|
|
414
|
+
self._external_pad + renderer.points_to_pixels(self.get_pad())
|
|
415
|
+
|
|
416
|
+
super().draw(renderer)
|
|
417
|
+
|
|
418
|
+
def get_window_extent(self, renderer=None):
|
|
419
|
+
if renderer is None:
|
|
420
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
421
|
+
if not self.get_visible():
|
|
422
|
+
return
|
|
423
|
+
|
|
424
|
+
r = self._external_pad + renderer.points_to_pixels(self.get_pad())
|
|
425
|
+
self._offset_radius = r
|
|
426
|
+
|
|
427
|
+
bb = super().get_window_extent(renderer)
|
|
428
|
+
|
|
429
|
+
return bb
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
class TickLabels(AxisLabel): # mtext.Text
|
|
433
|
+
"""
|
|
434
|
+
Tick labels. While derived from `.Text`, this single artist draws all
|
|
435
|
+
ticklabels. As in `.AxisLabel`, the position of the text is updated
|
|
436
|
+
in the fly, so changing text position has no effect. Otherwise,
|
|
437
|
+
the properties can be changed as a normal `.Text`. Unlike the
|
|
438
|
+
ticklabels of the mainline Matplotlib, properties of a single
|
|
439
|
+
ticklabel alone cannot be modified.
|
|
440
|
+
|
|
441
|
+
To change the pad between ticks and ticklabels, use `~.AxisLabel.set_pad`.
|
|
442
|
+
"""
|
|
443
|
+
|
|
444
|
+
def __init__(self, *, axis_direction="bottom", **kwargs):
|
|
445
|
+
super().__init__(**kwargs)
|
|
446
|
+
self.set_axis_direction(axis_direction)
|
|
447
|
+
self._axislabel_pad = 0
|
|
448
|
+
|
|
449
|
+
def get_ref_artist(self):
|
|
450
|
+
# docstring inherited
|
|
451
|
+
return self._axis.get_ticklabels()[0]
|
|
452
|
+
|
|
453
|
+
def set_axis_direction(self, label_direction):
|
|
454
|
+
"""
|
|
455
|
+
Adjust the text angle and text alignment of ticklabels
|
|
456
|
+
according to the Matplotlib convention.
|
|
457
|
+
|
|
458
|
+
The *label_direction* must be one of [left, right, bottom, top].
|
|
459
|
+
|
|
460
|
+
===================== ========== ========= ========== ==========
|
|
461
|
+
Property left bottom right top
|
|
462
|
+
===================== ========== ========= ========== ==========
|
|
463
|
+
ticklabel angle 90 0 -90 180
|
|
464
|
+
ticklabel va center baseline center baseline
|
|
465
|
+
ticklabel ha right center right center
|
|
466
|
+
===================== ========== ========= ========== ==========
|
|
467
|
+
|
|
468
|
+
Note that the text angles are actually relative to (90 + angle
|
|
469
|
+
of the direction to the ticklabel), which gives 0 for bottom
|
|
470
|
+
axis.
|
|
471
|
+
|
|
472
|
+
Parameters
|
|
473
|
+
----------
|
|
474
|
+
label_direction : {"left", "bottom", "right", "top"}
|
|
475
|
+
|
|
476
|
+
"""
|
|
477
|
+
self.set_default_alignment(label_direction)
|
|
478
|
+
self.set_default_angle(label_direction)
|
|
479
|
+
self._axis_direction = label_direction
|
|
480
|
+
|
|
481
|
+
def invert_axis_direction(self):
|
|
482
|
+
label_direction = self._get_opposite_direction(self._axis_direction)
|
|
483
|
+
self.set_axis_direction(label_direction)
|
|
484
|
+
|
|
485
|
+
def _get_ticklabels_offsets(self, renderer, label_direction):
|
|
486
|
+
"""
|
|
487
|
+
Calculate the ticklabel offsets from the tick and their total heights.
|
|
488
|
+
|
|
489
|
+
The offset only takes account the offset due to the vertical alignment
|
|
490
|
+
of the ticklabels: if axis direction is bottom and va is 'top', it will
|
|
491
|
+
return 0; if va is 'baseline', it will return (height-descent).
|
|
492
|
+
"""
|
|
493
|
+
whd_list = self.get_texts_widths_heights_descents(renderer)
|
|
494
|
+
|
|
495
|
+
if not whd_list:
|
|
496
|
+
return 0, 0
|
|
497
|
+
|
|
498
|
+
r = 0
|
|
499
|
+
va, ha = self.get_va(), self.get_ha()
|
|
500
|
+
|
|
501
|
+
if label_direction == "left":
|
|
502
|
+
pad = max(w for w, h, d in whd_list)
|
|
503
|
+
if ha == "left":
|
|
504
|
+
r = pad
|
|
505
|
+
elif ha == "center":
|
|
506
|
+
r = .5 * pad
|
|
507
|
+
elif label_direction == "right":
|
|
508
|
+
pad = max(w for w, h, d in whd_list)
|
|
509
|
+
if ha == "right":
|
|
510
|
+
r = pad
|
|
511
|
+
elif ha == "center":
|
|
512
|
+
r = .5 * pad
|
|
513
|
+
elif label_direction == "bottom":
|
|
514
|
+
pad = max(h for w, h, d in whd_list)
|
|
515
|
+
if va == "bottom":
|
|
516
|
+
r = pad
|
|
517
|
+
elif va == "center":
|
|
518
|
+
r = .5 * pad
|
|
519
|
+
elif va == "baseline":
|
|
520
|
+
max_ascent = max(h - d for w, h, d in whd_list)
|
|
521
|
+
max_descent = max(d for w, h, d in whd_list)
|
|
522
|
+
r = max_ascent
|
|
523
|
+
pad = max_ascent + max_descent
|
|
524
|
+
elif label_direction == "top":
|
|
525
|
+
pad = max(h for w, h, d in whd_list)
|
|
526
|
+
if va == "top":
|
|
527
|
+
r = pad
|
|
528
|
+
elif va == "center":
|
|
529
|
+
r = .5 * pad
|
|
530
|
+
elif va == "baseline":
|
|
531
|
+
max_ascent = max(h - d for w, h, d in whd_list)
|
|
532
|
+
max_descent = max(d for w, h, d in whd_list)
|
|
533
|
+
r = max_descent
|
|
534
|
+
pad = max_ascent + max_descent
|
|
535
|
+
|
|
536
|
+
# r : offset
|
|
537
|
+
# pad : total height of the ticklabels. This will be used to
|
|
538
|
+
# calculate the pad for the axislabel.
|
|
539
|
+
return r, pad
|
|
540
|
+
|
|
541
|
+
_default_alignments = dict(left=("center", "right"),
|
|
542
|
+
right=("center", "left"),
|
|
543
|
+
bottom=("baseline", "center"),
|
|
544
|
+
top=("baseline", "center"))
|
|
545
|
+
|
|
546
|
+
_default_angles = dict(left=90,
|
|
547
|
+
right=-90,
|
|
548
|
+
bottom=0,
|
|
549
|
+
top=180)
|
|
550
|
+
|
|
551
|
+
def draw(self, renderer):
|
|
552
|
+
if not self.get_visible():
|
|
553
|
+
self._axislabel_pad = self._external_pad
|
|
554
|
+
return
|
|
555
|
+
|
|
556
|
+
r, total_width = self._get_ticklabels_offsets(renderer,
|
|
557
|
+
self._axis_direction)
|
|
558
|
+
|
|
559
|
+
pad = self._external_pad + renderer.points_to_pixels(self.get_pad())
|
|
560
|
+
self._offset_radius = r + pad
|
|
561
|
+
|
|
562
|
+
for (x, y), a, l in self._locs_angles_labels:
|
|
563
|
+
if not l.strip():
|
|
564
|
+
continue
|
|
565
|
+
self._ref_angle = a
|
|
566
|
+
self.set_x(x)
|
|
567
|
+
self.set_y(y)
|
|
568
|
+
self.set_text(l)
|
|
569
|
+
LabelBase.draw(self, renderer)
|
|
570
|
+
|
|
571
|
+
# the value saved will be used to draw axislabel.
|
|
572
|
+
self._axislabel_pad = total_width + pad
|
|
573
|
+
|
|
574
|
+
def set_locs_angles_labels(self, locs_angles_labels):
|
|
575
|
+
self._locs_angles_labels = locs_angles_labels
|
|
576
|
+
|
|
577
|
+
def get_window_extents(self, renderer=None):
|
|
578
|
+
if renderer is None:
|
|
579
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
580
|
+
|
|
581
|
+
if not self.get_visible():
|
|
582
|
+
self._axislabel_pad = self._external_pad
|
|
583
|
+
return []
|
|
584
|
+
|
|
585
|
+
bboxes = []
|
|
586
|
+
|
|
587
|
+
r, total_width = self._get_ticklabels_offsets(renderer,
|
|
588
|
+
self._axis_direction)
|
|
589
|
+
|
|
590
|
+
pad = self._external_pad + renderer.points_to_pixels(self.get_pad())
|
|
591
|
+
self._offset_radius = r + pad
|
|
592
|
+
|
|
593
|
+
for (x, y), a, l in self._locs_angles_labels:
|
|
594
|
+
self._ref_angle = a
|
|
595
|
+
self.set_x(x)
|
|
596
|
+
self.set_y(y)
|
|
597
|
+
self.set_text(l)
|
|
598
|
+
bb = LabelBase.get_window_extent(self, renderer)
|
|
599
|
+
bboxes.append(bb)
|
|
600
|
+
|
|
601
|
+
# the value saved will be used to draw axislabel.
|
|
602
|
+
self._axislabel_pad = total_width + pad
|
|
603
|
+
|
|
604
|
+
return bboxes
|
|
605
|
+
|
|
606
|
+
def get_texts_widths_heights_descents(self, renderer):
|
|
607
|
+
"""
|
|
608
|
+
Return a list of ``(width, height, descent)`` tuples for ticklabels.
|
|
609
|
+
|
|
610
|
+
Empty labels are left out.
|
|
611
|
+
"""
|
|
612
|
+
whd_list = []
|
|
613
|
+
for _loc, _angle, label in self._locs_angles_labels:
|
|
614
|
+
if not label.strip():
|
|
615
|
+
continue
|
|
616
|
+
clean_line, ismath = self._preprocess_math(label)
|
|
617
|
+
whd = mtext._get_text_metrics_with_cache(
|
|
618
|
+
renderer, clean_line, self._fontproperties, ismath=ismath,
|
|
619
|
+
dpi=self.get_figure(root=True).dpi)
|
|
620
|
+
whd_list.append(whd)
|
|
621
|
+
return whd_list
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
class GridlinesCollection(LineCollection):
|
|
625
|
+
def __init__(self, *args, which="major", axis="both", **kwargs):
|
|
626
|
+
"""
|
|
627
|
+
Collection of grid lines.
|
|
628
|
+
|
|
629
|
+
Parameters
|
|
630
|
+
----------
|
|
631
|
+
which : {"major", "minor"}
|
|
632
|
+
Which grid to consider.
|
|
633
|
+
axis : {"both", "x", "y"}
|
|
634
|
+
Which axis to consider.
|
|
635
|
+
*args, **kwargs
|
|
636
|
+
Passed to `.LineCollection`.
|
|
637
|
+
"""
|
|
638
|
+
self._which = which
|
|
639
|
+
self._axis = axis
|
|
640
|
+
super().__init__(*args, **kwargs)
|
|
641
|
+
self.set_grid_helper(None)
|
|
642
|
+
|
|
643
|
+
def set_which(self, which):
|
|
644
|
+
"""
|
|
645
|
+
Select major or minor grid lines.
|
|
646
|
+
|
|
647
|
+
Parameters
|
|
648
|
+
----------
|
|
649
|
+
which : {"major", "minor"}
|
|
650
|
+
"""
|
|
651
|
+
self._which = which
|
|
652
|
+
|
|
653
|
+
def set_axis(self, axis):
|
|
654
|
+
"""
|
|
655
|
+
Select axis.
|
|
656
|
+
|
|
657
|
+
Parameters
|
|
658
|
+
----------
|
|
659
|
+
axis : {"both", "x", "y"}
|
|
660
|
+
"""
|
|
661
|
+
self._axis = axis
|
|
662
|
+
|
|
663
|
+
def set_grid_helper(self, grid_helper):
|
|
664
|
+
"""
|
|
665
|
+
Set grid helper.
|
|
666
|
+
|
|
667
|
+
Parameters
|
|
668
|
+
----------
|
|
669
|
+
grid_helper : `.GridHelperBase` subclass
|
|
670
|
+
"""
|
|
671
|
+
self._grid_helper = grid_helper
|
|
672
|
+
|
|
673
|
+
def draw(self, renderer):
|
|
674
|
+
if self._grid_helper is not None:
|
|
675
|
+
self._grid_helper.update_lim(self.axes)
|
|
676
|
+
gl = self._grid_helper.get_gridlines(self._which, self._axis)
|
|
677
|
+
self.set_segments([np.transpose(l) for l in gl])
|
|
678
|
+
super().draw(renderer)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
class AxisArtist(martist.Artist):
|
|
682
|
+
"""
|
|
683
|
+
An artist which draws axis (a line along which the n-th axes coord
|
|
684
|
+
is constant) line, ticks, tick labels, and axis label.
|
|
685
|
+
"""
|
|
686
|
+
|
|
687
|
+
zorder = 2.5
|
|
688
|
+
|
|
689
|
+
@property
|
|
690
|
+
def LABELPAD(self):
|
|
691
|
+
return self.label.get_pad()
|
|
692
|
+
|
|
693
|
+
@LABELPAD.setter
|
|
694
|
+
def LABELPAD(self, v):
|
|
695
|
+
self.label.set_pad(v)
|
|
696
|
+
|
|
697
|
+
def __init__(self, axes,
|
|
698
|
+
helper,
|
|
699
|
+
offset=None,
|
|
700
|
+
axis_direction="bottom",
|
|
701
|
+
**kwargs):
|
|
702
|
+
"""
|
|
703
|
+
Parameters
|
|
704
|
+
----------
|
|
705
|
+
axes : `mpl_toolkits.axisartist.axislines.Axes`
|
|
706
|
+
helper : `~mpl_toolkits.axisartist.axislines.AxisArtistHelper`
|
|
707
|
+
"""
|
|
708
|
+
# axes is also used to follow the axis attribute (tick color, etc).
|
|
709
|
+
|
|
710
|
+
super().__init__(**kwargs)
|
|
711
|
+
|
|
712
|
+
self.axes = axes
|
|
713
|
+
|
|
714
|
+
self._axis_artist_helper = helper
|
|
715
|
+
|
|
716
|
+
if offset is None:
|
|
717
|
+
offset = (0, 0)
|
|
718
|
+
self.offset_transform = ScaledTranslation(
|
|
719
|
+
*offset,
|
|
720
|
+
Affine2D().scale(1 / 72) # points to inches.
|
|
721
|
+
+ self.axes.get_figure(root=False).dpi_scale_trans)
|
|
722
|
+
|
|
723
|
+
if axis_direction in ["left", "right"]:
|
|
724
|
+
self.axis = axes.yaxis
|
|
725
|
+
else:
|
|
726
|
+
self.axis = axes.xaxis
|
|
727
|
+
|
|
728
|
+
self._axisline_style = None
|
|
729
|
+
self._axis_direction = axis_direction
|
|
730
|
+
|
|
731
|
+
self._init_line()
|
|
732
|
+
self._init_ticks(**kwargs)
|
|
733
|
+
self._init_offsetText(axis_direction)
|
|
734
|
+
self._init_label()
|
|
735
|
+
|
|
736
|
+
# axis direction
|
|
737
|
+
self._ticklabel_add_angle = 0.
|
|
738
|
+
self._axislabel_add_angle = 0.
|
|
739
|
+
self.set_axis_direction(axis_direction)
|
|
740
|
+
|
|
741
|
+
# axis direction
|
|
742
|
+
|
|
743
|
+
def set_axis_direction(self, axis_direction):
|
|
744
|
+
"""
|
|
745
|
+
Adjust the direction, text angle, and text alignment of tick labels
|
|
746
|
+
and axis labels following the Matplotlib convention for the rectangle
|
|
747
|
+
axes.
|
|
748
|
+
|
|
749
|
+
The *axis_direction* must be one of [left, right, bottom, top].
|
|
750
|
+
|
|
751
|
+
===================== ========== ========= ========== ==========
|
|
752
|
+
Property left bottom right top
|
|
753
|
+
===================== ========== ========= ========== ==========
|
|
754
|
+
ticklabel direction "-" "+" "+" "-"
|
|
755
|
+
axislabel direction "-" "+" "+" "-"
|
|
756
|
+
ticklabel angle 90 0 -90 180
|
|
757
|
+
ticklabel va center baseline center baseline
|
|
758
|
+
ticklabel ha right center right center
|
|
759
|
+
axislabel angle 180 0 0 180
|
|
760
|
+
axislabel va center top center bottom
|
|
761
|
+
axislabel ha right center right center
|
|
762
|
+
===================== ========== ========= ========== ==========
|
|
763
|
+
|
|
764
|
+
Note that the direction "+" and "-" are relative to the direction of
|
|
765
|
+
the increasing coordinate. Also, the text angles are actually
|
|
766
|
+
relative to (90 + angle of the direction to the ticklabel),
|
|
767
|
+
which gives 0 for bottom axis.
|
|
768
|
+
|
|
769
|
+
Parameters
|
|
770
|
+
----------
|
|
771
|
+
axis_direction : {"left", "bottom", "right", "top"}
|
|
772
|
+
"""
|
|
773
|
+
self.major_ticklabels.set_axis_direction(axis_direction)
|
|
774
|
+
self.label.set_axis_direction(axis_direction)
|
|
775
|
+
self._axis_direction = axis_direction
|
|
776
|
+
if axis_direction in ["left", "top"]:
|
|
777
|
+
self.set_ticklabel_direction("-")
|
|
778
|
+
self.set_axislabel_direction("-")
|
|
779
|
+
else:
|
|
780
|
+
self.set_ticklabel_direction("+")
|
|
781
|
+
self.set_axislabel_direction("+")
|
|
782
|
+
|
|
783
|
+
def set_ticklabel_direction(self, tick_direction):
|
|
784
|
+
r"""
|
|
785
|
+
Adjust the direction of the tick labels.
|
|
786
|
+
|
|
787
|
+
Note that the *tick_direction*\s '+' and '-' are relative to the
|
|
788
|
+
direction of the increasing coordinate.
|
|
789
|
+
|
|
790
|
+
Parameters
|
|
791
|
+
----------
|
|
792
|
+
tick_direction : {"+", "-"}
|
|
793
|
+
"""
|
|
794
|
+
self._ticklabel_add_angle = _api.getitem_checked(
|
|
795
|
+
{"+": 0, "-": 180}, tick_direction=tick_direction)
|
|
796
|
+
|
|
797
|
+
def invert_ticklabel_direction(self):
|
|
798
|
+
self._ticklabel_add_angle = (self._ticklabel_add_angle + 180) % 360
|
|
799
|
+
self.major_ticklabels.invert_axis_direction()
|
|
800
|
+
self.minor_ticklabels.invert_axis_direction()
|
|
801
|
+
|
|
802
|
+
def set_axislabel_direction(self, label_direction):
|
|
803
|
+
r"""
|
|
804
|
+
Adjust the direction of the axis label.
|
|
805
|
+
|
|
806
|
+
Note that the *label_direction*\s '+' and '-' are relative to the
|
|
807
|
+
direction of the increasing coordinate.
|
|
808
|
+
|
|
809
|
+
Parameters
|
|
810
|
+
----------
|
|
811
|
+
label_direction : {"+", "-"}
|
|
812
|
+
"""
|
|
813
|
+
self._axislabel_add_angle = _api.getitem_checked(
|
|
814
|
+
{"+": 0, "-": 180}, label_direction=label_direction)
|
|
815
|
+
|
|
816
|
+
def get_transform(self):
|
|
817
|
+
return self.axes.transAxes + self.offset_transform
|
|
818
|
+
|
|
819
|
+
def get_helper(self):
|
|
820
|
+
"""
|
|
821
|
+
Return axis artist helper instance.
|
|
822
|
+
"""
|
|
823
|
+
return self._axis_artist_helper
|
|
824
|
+
|
|
825
|
+
def set_axisline_style(self, axisline_style=None, **kwargs):
|
|
826
|
+
"""
|
|
827
|
+
Set the axisline style.
|
|
828
|
+
|
|
829
|
+
The new style is completely defined by the passed attributes. Existing
|
|
830
|
+
style attributes are forgotten.
|
|
831
|
+
|
|
832
|
+
Parameters
|
|
833
|
+
----------
|
|
834
|
+
axisline_style : str or None
|
|
835
|
+
The line style, e.g. '->', optionally followed by a comma-separated
|
|
836
|
+
list of attributes. Alternatively, the attributes can be provided
|
|
837
|
+
as keywords.
|
|
838
|
+
|
|
839
|
+
If *None* this returns a string containing the available styles.
|
|
840
|
+
|
|
841
|
+
Examples
|
|
842
|
+
--------
|
|
843
|
+
The following two commands are equal:
|
|
844
|
+
|
|
845
|
+
>>> set_axisline_style("->,size=1.5")
|
|
846
|
+
>>> set_axisline_style("->", size=1.5)
|
|
847
|
+
"""
|
|
848
|
+
if axisline_style is None:
|
|
849
|
+
return AxislineStyle.pprint_styles()
|
|
850
|
+
|
|
851
|
+
if isinstance(axisline_style, AxislineStyle._Base):
|
|
852
|
+
self._axisline_style = axisline_style
|
|
853
|
+
else:
|
|
854
|
+
self._axisline_style = AxislineStyle(axisline_style, **kwargs)
|
|
855
|
+
|
|
856
|
+
self._init_line()
|
|
857
|
+
|
|
858
|
+
def get_axisline_style(self):
|
|
859
|
+
"""Return the current axisline style."""
|
|
860
|
+
return self._axisline_style
|
|
861
|
+
|
|
862
|
+
def _init_line(self):
|
|
863
|
+
"""
|
|
864
|
+
Initialize the *line* artist that is responsible to draw the axis line.
|
|
865
|
+
"""
|
|
866
|
+
tran = (self._axis_artist_helper.get_line_transform(self.axes)
|
|
867
|
+
+ self.offset_transform)
|
|
868
|
+
|
|
869
|
+
axisline_style = self.get_axisline_style()
|
|
870
|
+
if axisline_style is None:
|
|
871
|
+
self.line = PathPatch(
|
|
872
|
+
self._axis_artist_helper.get_line(self.axes),
|
|
873
|
+
color=mpl.rcParams['axes.edgecolor'],
|
|
874
|
+
fill=False,
|
|
875
|
+
linewidth=mpl.rcParams['axes.linewidth'],
|
|
876
|
+
capstyle=mpl.rcParams['lines.solid_capstyle'],
|
|
877
|
+
joinstyle=mpl.rcParams['lines.solid_joinstyle'],
|
|
878
|
+
transform=tran)
|
|
879
|
+
else:
|
|
880
|
+
self.line = axisline_style(self, transform=tran)
|
|
881
|
+
|
|
882
|
+
def _draw_line(self, renderer):
|
|
883
|
+
self.line.set_path(self._axis_artist_helper.get_line(self.axes))
|
|
884
|
+
if self.get_axisline_style() is not None:
|
|
885
|
+
self.line.set_line_mutation_scale(self.major_ticklabels.get_size())
|
|
886
|
+
self.line.draw(renderer)
|
|
887
|
+
|
|
888
|
+
def _init_ticks(self, **kwargs):
|
|
889
|
+
axis_name = self.axis.axis_name
|
|
890
|
+
|
|
891
|
+
trans = (self._axis_artist_helper.get_tick_transform(self.axes)
|
|
892
|
+
+ self.offset_transform)
|
|
893
|
+
|
|
894
|
+
self.major_ticks = Ticks(
|
|
895
|
+
ticksize=kwargs.get(
|
|
896
|
+
"major_tick_size",
|
|
897
|
+
mpl.rcParams[f"{axis_name}tick.major.size"]),
|
|
898
|
+
tick_direction=mpl.rcParams[f"{axis_name}tick.direction"],
|
|
899
|
+
axis=self.axis, transform=trans)
|
|
900
|
+
self.minor_ticks = Ticks(
|
|
901
|
+
ticksize=kwargs.get(
|
|
902
|
+
"minor_tick_size",
|
|
903
|
+
mpl.rcParams[f"{axis_name}tick.minor.size"]),
|
|
904
|
+
tick_direction=mpl.rcParams[f"{axis_name}tick.direction"],
|
|
905
|
+
axis=self.axis, transform=trans)
|
|
906
|
+
|
|
907
|
+
size = mpl.rcParams[f"{axis_name}tick.labelsize"]
|
|
908
|
+
self.major_ticklabels = TickLabels(
|
|
909
|
+
axis=self.axis,
|
|
910
|
+
axis_direction=self._axis_direction,
|
|
911
|
+
figure=self.axes.get_figure(root=False),
|
|
912
|
+
transform=trans,
|
|
913
|
+
fontsize=size,
|
|
914
|
+
pad=kwargs.get(
|
|
915
|
+
"major_tick_pad", mpl.rcParams[f"{axis_name}tick.major.pad"]),
|
|
916
|
+
)
|
|
917
|
+
self.minor_ticklabels = TickLabels(
|
|
918
|
+
axis=self.axis,
|
|
919
|
+
axis_direction=self._axis_direction,
|
|
920
|
+
figure=self.axes.get_figure(root=False),
|
|
921
|
+
transform=trans,
|
|
922
|
+
fontsize=size,
|
|
923
|
+
pad=kwargs.get(
|
|
924
|
+
"minor_tick_pad", mpl.rcParams[f"{axis_name}tick.minor.pad"]),
|
|
925
|
+
)
|
|
926
|
+
|
|
927
|
+
def _get_tick_info(self, tick_iter):
|
|
928
|
+
"""
|
|
929
|
+
Return a pair of:
|
|
930
|
+
|
|
931
|
+
- list of locs and angles for ticks
|
|
932
|
+
- list of locs, angles and labels for ticklabels.
|
|
933
|
+
"""
|
|
934
|
+
ticks_loc_angle = []
|
|
935
|
+
ticklabels_loc_angle_label = []
|
|
936
|
+
|
|
937
|
+
ticklabel_add_angle = self._ticklabel_add_angle
|
|
938
|
+
|
|
939
|
+
for loc, angle_normal, angle_tangent, label in tick_iter:
|
|
940
|
+
angle_label = angle_tangent - 90 + ticklabel_add_angle
|
|
941
|
+
angle_tick = (angle_normal
|
|
942
|
+
if 90 <= (angle_label - angle_normal) % 360 <= 270
|
|
943
|
+
else angle_normal + 180)
|
|
944
|
+
ticks_loc_angle.append([loc, angle_tick])
|
|
945
|
+
ticklabels_loc_angle_label.append([loc, angle_label, label])
|
|
946
|
+
|
|
947
|
+
return ticks_loc_angle, ticklabels_loc_angle_label
|
|
948
|
+
|
|
949
|
+
def _update_ticks(self, renderer=None):
|
|
950
|
+
# set extra pad for major and minor ticklabels: use ticksize of
|
|
951
|
+
# majorticks even for minor ticks. not clear what is best.
|
|
952
|
+
|
|
953
|
+
if renderer is None:
|
|
954
|
+
renderer = self.get_figure(root=True)._get_renderer()
|
|
955
|
+
|
|
956
|
+
self.major_ticklabels._external_pad = \
|
|
957
|
+
self.minor_ticklabels._external_pad = (
|
|
958
|
+
renderer.points_to_pixels(self.major_ticks._ticksize)
|
|
959
|
+
* {"in": 0, "inout": 1/2, "out": 1}[
|
|
960
|
+
self.major_ticks.get_tick_direction()]
|
|
961
|
+
* self.major_ticks.get_visible() # 0 if invisible.
|
|
962
|
+
)
|
|
963
|
+
|
|
964
|
+
majortick_iter, minortick_iter = \
|
|
965
|
+
self._axis_artist_helper.get_tick_iterators(self.axes)
|
|
966
|
+
|
|
967
|
+
tick_loc_angle, ticklabel_loc_angle_label = \
|
|
968
|
+
self._get_tick_info(majortick_iter)
|
|
969
|
+
self.major_ticks.set_locs_angles(tick_loc_angle)
|
|
970
|
+
self.major_ticklabels.set_locs_angles_labels(ticklabel_loc_angle_label)
|
|
971
|
+
|
|
972
|
+
tick_loc_angle, ticklabel_loc_angle_label = \
|
|
973
|
+
self._get_tick_info(minortick_iter)
|
|
974
|
+
self.minor_ticks.set_locs_angles(tick_loc_angle)
|
|
975
|
+
self.minor_ticklabels.set_locs_angles_labels(ticklabel_loc_angle_label)
|
|
976
|
+
|
|
977
|
+
def _draw_ticks(self, renderer):
|
|
978
|
+
self._update_ticks(renderer)
|
|
979
|
+
self.major_ticks.draw(renderer)
|
|
980
|
+
self.major_ticklabels.draw(renderer)
|
|
981
|
+
self.minor_ticks.draw(renderer)
|
|
982
|
+
self.minor_ticklabels.draw(renderer)
|
|
983
|
+
if (self.major_ticklabels.get_visible()
|
|
984
|
+
or self.minor_ticklabels.get_visible()):
|
|
985
|
+
self._draw_offsetText(renderer)
|
|
986
|
+
|
|
987
|
+
_offsetText_pos = dict(left=(0, 1, "bottom", "right"),
|
|
988
|
+
right=(1, 1, "bottom", "left"),
|
|
989
|
+
bottom=(1, 0, "top", "right"),
|
|
990
|
+
top=(1, 1, "bottom", "right"))
|
|
991
|
+
|
|
992
|
+
def _init_offsetText(self, direction):
|
|
993
|
+
x, y, va, ha = self._offsetText_pos[direction]
|
|
994
|
+
self.offsetText = mtext.Annotation(
|
|
995
|
+
"",
|
|
996
|
+
xy=(x, y), xycoords="axes fraction",
|
|
997
|
+
xytext=(0, 0), textcoords="offset points",
|
|
998
|
+
color=mpl.rcParams['xtick.color'],
|
|
999
|
+
horizontalalignment=ha, verticalalignment=va,
|
|
1000
|
+
)
|
|
1001
|
+
self.offsetText.set_transform(IdentityTransform())
|
|
1002
|
+
self.axes._set_artist_props(self.offsetText)
|
|
1003
|
+
|
|
1004
|
+
def _update_offsetText(self):
|
|
1005
|
+
self.offsetText.set_text(self.axis.major.formatter.get_offset())
|
|
1006
|
+
self.offsetText.set_size(self.major_ticklabels.get_size())
|
|
1007
|
+
offset = (self.major_ticklabels.get_pad()
|
|
1008
|
+
+ self.major_ticklabels.get_size()
|
|
1009
|
+
+ 2)
|
|
1010
|
+
self.offsetText.xyann = (0, offset)
|
|
1011
|
+
|
|
1012
|
+
def _draw_offsetText(self, renderer):
|
|
1013
|
+
self._update_offsetText()
|
|
1014
|
+
self.offsetText.draw(renderer)
|
|
1015
|
+
|
|
1016
|
+
def _init_label(self, **kwargs):
|
|
1017
|
+
tr = (self._axis_artist_helper.get_axislabel_transform(self.axes)
|
|
1018
|
+
+ self.offset_transform)
|
|
1019
|
+
self.label = AxisLabel(
|
|
1020
|
+
0, 0, "__from_axes__",
|
|
1021
|
+
color="auto",
|
|
1022
|
+
fontsize=kwargs.get("labelsize", mpl.rcParams['axes.labelsize']),
|
|
1023
|
+
fontweight=mpl.rcParams['axes.labelweight'],
|
|
1024
|
+
axis=self.axis,
|
|
1025
|
+
transform=tr,
|
|
1026
|
+
axis_direction=self._axis_direction,
|
|
1027
|
+
)
|
|
1028
|
+
self.label.set_figure(self.axes.get_figure(root=False))
|
|
1029
|
+
labelpad = kwargs.get("labelpad", 5)
|
|
1030
|
+
self.label.set_pad(labelpad)
|
|
1031
|
+
|
|
1032
|
+
def _update_label(self, renderer):
|
|
1033
|
+
if not self.label.get_visible():
|
|
1034
|
+
return
|
|
1035
|
+
|
|
1036
|
+
if self._ticklabel_add_angle != self._axislabel_add_angle:
|
|
1037
|
+
axislabel_pad = max(
|
|
1038
|
+
# major pad:
|
|
1039
|
+
self.major_ticks._ticksize
|
|
1040
|
+
* {"in": 1, "inout": 1/2, "out": 0}[
|
|
1041
|
+
self.major_ticks.get_tick_direction()]
|
|
1042
|
+
* self.major_ticks.get_visible(), # 0 if invisible.
|
|
1043
|
+
# minor pad:
|
|
1044
|
+
self.minor_ticks._ticksize
|
|
1045
|
+
* {"in": 1, "inout": 1/2, "out": 0}[
|
|
1046
|
+
self.minor_ticks.get_tick_direction()]
|
|
1047
|
+
* self.minor_ticks.get_visible(), # 0 if invisible.
|
|
1048
|
+
)
|
|
1049
|
+
else:
|
|
1050
|
+
axislabel_pad = max(self.major_ticklabels._axislabel_pad,
|
|
1051
|
+
self.minor_ticklabels._axislabel_pad)
|
|
1052
|
+
|
|
1053
|
+
self.label._external_pad = axislabel_pad
|
|
1054
|
+
|
|
1055
|
+
xy, angle_tangent = \
|
|
1056
|
+
self._axis_artist_helper.get_axislabel_pos_angle(self.axes)
|
|
1057
|
+
if xy is None:
|
|
1058
|
+
return
|
|
1059
|
+
|
|
1060
|
+
angle_label = angle_tangent - 90
|
|
1061
|
+
|
|
1062
|
+
x, y = xy
|
|
1063
|
+
self.label._ref_angle = angle_label + self._axislabel_add_angle
|
|
1064
|
+
self.label.set(x=x, y=y)
|
|
1065
|
+
|
|
1066
|
+
def _draw_label(self, renderer):
|
|
1067
|
+
self._update_label(renderer)
|
|
1068
|
+
self.label.draw(renderer)
|
|
1069
|
+
|
|
1070
|
+
def set_label(self, s):
|
|
1071
|
+
# docstring inherited
|
|
1072
|
+
self.label.set_text(s)
|
|
1073
|
+
|
|
1074
|
+
def get_tightbbox(self, renderer=None):
|
|
1075
|
+
if not self.get_visible():
|
|
1076
|
+
return
|
|
1077
|
+
self._axis_artist_helper.update_lim(self.axes)
|
|
1078
|
+
self._update_ticks(renderer)
|
|
1079
|
+
self._update_label(renderer)
|
|
1080
|
+
|
|
1081
|
+
self.line.set_path(self._axis_artist_helper.get_line(self.axes))
|
|
1082
|
+
if self.get_axisline_style() is not None:
|
|
1083
|
+
self.line.set_line_mutation_scale(self.major_ticklabels.get_size())
|
|
1084
|
+
|
|
1085
|
+
bb = [
|
|
1086
|
+
*self.major_ticklabels.get_window_extents(renderer),
|
|
1087
|
+
*self.minor_ticklabels.get_window_extents(renderer),
|
|
1088
|
+
self.label.get_window_extent(renderer),
|
|
1089
|
+
self.offsetText.get_window_extent(renderer),
|
|
1090
|
+
self.line.get_tightbbox(renderer),
|
|
1091
|
+
]
|
|
1092
|
+
bb = [b for b in bb if b and (b.width != 0 or b.height != 0)]
|
|
1093
|
+
if bb:
|
|
1094
|
+
_bbox = Bbox.union(bb)
|
|
1095
|
+
return _bbox
|
|
1096
|
+
else:
|
|
1097
|
+
return None
|
|
1098
|
+
|
|
1099
|
+
@martist.allow_rasterization
|
|
1100
|
+
def draw(self, renderer):
|
|
1101
|
+
# docstring inherited
|
|
1102
|
+
if not self.get_visible():
|
|
1103
|
+
return
|
|
1104
|
+
renderer.open_group('mpl_toolkits.axisartist.axis_artist', gid=self.get_gid())
|
|
1105
|
+
self._axis_artist_helper.update_lim(self.axes)
|
|
1106
|
+
self._draw_ticks(renderer)
|
|
1107
|
+
self._draw_line(renderer)
|
|
1108
|
+
self._draw_label(renderer)
|
|
1109
|
+
renderer.close_group(__name__)
|
|
1110
|
+
|
|
1111
|
+
def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
|
|
1112
|
+
"""
|
|
1113
|
+
Toggle visibility of ticks, ticklabels, and (axis) label.
|
|
1114
|
+
To turn all off, ::
|
|
1115
|
+
|
|
1116
|
+
axis.toggle(all=False)
|
|
1117
|
+
|
|
1118
|
+
To turn all off but ticks on ::
|
|
1119
|
+
|
|
1120
|
+
axis.toggle(all=False, ticks=True)
|
|
1121
|
+
|
|
1122
|
+
To turn all on but (axis) label off ::
|
|
1123
|
+
|
|
1124
|
+
axis.toggle(all=True, label=False)
|
|
1125
|
+
|
|
1126
|
+
"""
|
|
1127
|
+
if all:
|
|
1128
|
+
_ticks, _ticklabels, _label = True, True, True
|
|
1129
|
+
elif all is not None:
|
|
1130
|
+
_ticks, _ticklabels, _label = False, False, False
|
|
1131
|
+
else:
|
|
1132
|
+
_ticks, _ticklabels, _label = None, None, None
|
|
1133
|
+
|
|
1134
|
+
if ticks is not None:
|
|
1135
|
+
_ticks = ticks
|
|
1136
|
+
if ticklabels is not None:
|
|
1137
|
+
_ticklabels = ticklabels
|
|
1138
|
+
if label is not None:
|
|
1139
|
+
_label = label
|
|
1140
|
+
|
|
1141
|
+
if _ticks is not None:
|
|
1142
|
+
self.major_ticks.set_visible(_ticks)
|
|
1143
|
+
self.minor_ticks.set_visible(_ticks)
|
|
1144
|
+
if _ticklabels is not None:
|
|
1145
|
+
self.major_ticklabels.set_visible(_ticklabels)
|
|
1146
|
+
self.minor_ticklabels.set_visible(_ticklabels)
|
|
1147
|
+
if _label is not None:
|
|
1148
|
+
self.label.set_visible(_label)
|