unxts.interop.matplotlib 2.0.1__py3-none-any.whl → 2.2.0__py3-none-any.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.
- unxts/interop/matplotlib/_src/converter.py +28 -6
- unxts/interop/matplotlib/_version.py +2 -2
- {unxts_interop_matplotlib-2.0.1.dist-info → unxts_interop_matplotlib-2.2.0.dist-info}/METADATA +1 -1
- unxts_interop_matplotlib-2.2.0.dist-info/RECORD +9 -0
- {unxts_interop_matplotlib-2.0.1.dist-info → unxts_interop_matplotlib-2.2.0.dist-info}/WHEEL +1 -1
- unxts_interop_matplotlib-2.0.1.dist-info/RECORD +0 -9
- {unxts_interop_matplotlib-2.0.1.dist-info → unxts_interop_matplotlib-2.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
__all__ = ("UnxtConverter", "setup_matplotlib_support_for_unxt")
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
import warnings
|
|
10
11
|
from collections.abc import Iterable, Sized
|
|
11
12
|
from dataclasses import dataclass, field
|
|
12
13
|
from typing import Any
|
|
@@ -30,10 +31,32 @@ class UnxtConverter(matplotlib.units.ConversionInterface): # type: ignore[misc]
|
|
|
30
31
|
|
|
31
32
|
"""
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
unit_format: str = "latex_inline"
|
|
35
|
+
"""`astropy` unit format for the axis label (see ``Unit.to_string``)."""
|
|
36
|
+
|
|
37
|
+
axisinfo_kw: dict[str, Any] | None = field(default=None, init=True, repr=False)
|
|
38
|
+
"""Deprecated: use ``unit_format`` instead.
|
|
39
|
+
|
|
40
|
+
.. deprecated:: 2.0.0
|
|
41
|
+
Use ``unit_format`` directly instead of ``axisinfo_kw={"format": ...}``.
|
|
42
|
+
This parameter will be removed in a future release.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __post_init__(self) -> None:
|
|
46
|
+
"""Handle deprecated ``axisinfo_kw`` parameter."""
|
|
47
|
+
if self.axisinfo_kw is not None:
|
|
48
|
+
warnings.warn(
|
|
49
|
+
"The `axisinfo_kw` parameter is deprecated and will be removed "
|
|
50
|
+
"in a future release. Use `unit_format` directly instead. "
|
|
51
|
+
"For example, use `UnxtConverter(unit_format='latex')` instead of "
|
|
52
|
+
"`UnxtConverter(axisinfo_kw={'format': 'latex'})`.",
|
|
53
|
+
category=DeprecationWarning,
|
|
54
|
+
stacklevel=2,
|
|
55
|
+
)
|
|
56
|
+
# Extract format from the dict and set unit_format
|
|
57
|
+
if "format" in self.axisinfo_kw:
|
|
58
|
+
# Use object.__setattr__ since this is a frozen dataclass in spirit
|
|
59
|
+
object.__setattr__(self, "unit_format", self.axisinfo_kw["format"])
|
|
37
60
|
|
|
38
61
|
def convert(self, obj: Any, unit: Any, axis: Axes) -> Array | list[Array]:
|
|
39
62
|
"""Convert *obj* using *unit* for the specified *axis*."""
|
|
@@ -60,8 +83,7 @@ class UnxtConverter(matplotlib.units.ConversionInterface): # type: ignore[misc]
|
|
|
60
83
|
# matplotlib may query axisinfo before any unit has been set on the axis.
|
|
61
84
|
if unit is None:
|
|
62
85
|
return matplotlib.units.AxisInfo()
|
|
63
|
-
|
|
64
|
-
return matplotlib.units.AxisInfo(label=unit.to_string(fmt))
|
|
86
|
+
return matplotlib.units.AxisInfo(label=unit.to_string(self.unit_format))
|
|
65
87
|
|
|
66
88
|
@staticmethod
|
|
67
89
|
def default_units(x: Any, _: Axes) -> Any:
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.0
|
|
22
|
-
__version_tuple__ = version_tuple = (2,
|
|
21
|
+
__version__ = version = '2.2.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 2, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
{unxts_interop_matplotlib-2.0.1.dist-info → unxts_interop_matplotlib-2.2.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: unxts.interop.matplotlib
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: matplotlib integration for unxt (canonical: unxts.interop.matplotlib)
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/GalacticDynamics/unxt/issues
|
|
6
6
|
Project-URL: Homepage, https://github.com/GalacticDynamics/unxt
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
unxts/interop/matplotlib/__init__.py,sha256=HYpqkgkjvsfhnyyBMQjfdebXcVduCz6YLLONMHii6YI,474
|
|
2
|
+
unxts/interop/matplotlib/_version.py,sha256=hr28JFSw-8QN1uunsHJx1LBz0QF7sJ_ntX0tGWncjFk,520
|
|
3
|
+
unxts/interop/matplotlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
unxts/interop/matplotlib/_src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
unxts/interop/matplotlib/_src/converter.py,sha256=6WL_j7rd_0wCIM3KnIj6t-L-IsID8_A926XKZzzCryI,4293
|
|
6
|
+
unxts_interop_matplotlib-2.2.0.dist-info/METADATA,sha256=56aTOL5uB_kUopeF6ZDLrvlaPVpwmaPu5Kmm1ruj1W4,1607
|
|
7
|
+
unxts_interop_matplotlib-2.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
8
|
+
unxts_interop_matplotlib-2.2.0.dist-info/licenses/LICENSE,sha256=dZw7glr5UgpWO9a1jlC004HhtLTytJbcQO9pQVMLk7g,1519
|
|
9
|
+
unxts_interop_matplotlib-2.2.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
unxts/interop/matplotlib/__init__.py,sha256=HYpqkgkjvsfhnyyBMQjfdebXcVduCz6YLLONMHii6YI,474
|
|
2
|
-
unxts/interop/matplotlib/_version.py,sha256=AJvqZqEOrEKVHQbALacgWiM-1U44ZzqQ-ZsR-NbTbjg,520
|
|
3
|
-
unxts/interop/matplotlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
unxts/interop/matplotlib/_src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
unxts/interop/matplotlib/_src/converter.py,sha256=kM3n8a9ve-EqvNPqLaA05gHPuXW5tYOtTOFvzcllbsU,3253
|
|
6
|
-
unxts_interop_matplotlib-2.0.1.dist-info/METADATA,sha256=c0ahgeAucPcEtlJ3Tdo5MwFx7z0utQj4N6VUbZ0EQow,1607
|
|
7
|
-
unxts_interop_matplotlib-2.0.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
8
|
-
unxts_interop_matplotlib-2.0.1.dist-info/licenses/LICENSE,sha256=dZw7glr5UgpWO9a1jlC004HhtLTytJbcQO9pQVMLk7g,1519
|
|
9
|
-
unxts_interop_matplotlib-2.0.1.dist-info/RECORD,,
|
|
File without changes
|