8000 DOC: add units to user/explain [ci doc] · matplotlib/matplotlib@b420c9d · GitHub
[go: up one dir, main page]

Skip to content

Commit b420c9d

Browse files
committed
DOC: add units to user/explain [ci doc]
1 parent feb602a commit b420c9d

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed
< 8000 button class="Button Button--iconOnly Button--invisible flex-shrink-0 flex-order-1" aria-label="Collapse file: galleries/users_explain/axes/axes_units.py">

galleries/users_explain/axes/axes_units.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
.. _user_axes_units:
33
4-
=========================================
5-
Plotting beyond floats: dates and strings
6-
=========================================
4+
==========================
5+
Plotting dates and strings
6+
==========================
77
88
The most basic way to use Matplotlib plotting methods is to pass coordinates in
99
as numerical numpy arrays. For example, ``plot(x, y)`` will work if ``x`` and
@@ -275,11 +275,19 @@
275275
# converter will be ``_SwitchableDateConverter``; if it has has strings in it,
276276
# it will be sent to the ``StrCategoryConverter``.
277277

278-
for k in munits.registry:
279-
print(f"type: {k};\n converter: {munits.registry[k]}")
278+
for k, v in munits.registry.items():
279+
print(f"type: {k};\n converter: {type(v)}")
280280

281281
# %%
282282
#
283-
# Downstream libraries like `pandas <https://pandas.pydata.org>`_,
284-
# `astropy <https://www.astropy.org>`_, `pint <https://pint.readthedocs.io>`_
285-
# and others supply their own converters that can be used with Matplotlib.
283+
# There are a number of downstream libraries that provide their own converters
284+
# with locators and formatters. Physical unit support is provided by
285+
# `astropy <https://www.astropy.org>`_, `pint <https://pint.readthedocs.io>`_, and
286+
# `unyt <https://unyt.readthedocs.io>`_, among others.
287+
#
288+
# High level libraries like `pandas <https://pandas.pydata.org>`_ and
289+
# `nc-time-axis <https://nc-time-axis.readthedocs.io>`_ (and thus
290+
# `xarray <https://docs.xarray.dev>`_) provide their own datetime support.
291+
# This support can sometimes be incompatible with Matplotlib native datetime
292+
# support, so care should be taken when using Matplotlib locators and
293+
# formatters if these libraries are being used.

galleries/users_explain/axes/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ annotations like x- and y-labels, titles, and legends.
2424
color='darkgrey')
2525
fig.suptitle('plt.subplots()')
2626

27-
2827
.. toctree::
2928
:maxdepth: 2
3029

0 commit comments

Comments
 (0)
0