|
1 | 1 | """
|
2 | 2 | .. _user_axes_units:
|
3 | 3 |
|
4 |
| -========================================= |
5 |
| -Plotting beyond floats: dates and strings |
6 |
| -========================================= |
| 4 | +========================== |
| 5 | +Plotting dates and strings |
| 6 | +========================== |
7 | 7 |
|
8 | 8 | The most basic way to use Matplotlib plotting methods is to pass coordinates in
|
9 | 9 | as numerical numpy arrays. For example, ``plot(x, y)`` will work if ``x`` and
|
|
275 | 275 | # converter will be ``_SwitchableDateConverter``; if it has has strings in it,
|
276 | 276 | # it will be sent to the ``StrCategoryConverter``.
|
277 | 277 |
|
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)}") |
280 | 280 |
|
281 | 281 | # %%
|
282 | 282 | #
|
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. |
0 commit comments