MatplotLibAPI 3.2.14__py3-none-any.whl → 3.2.16__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.
- MatplotLibAPI/Area.py +76 -0
- MatplotLibAPI/Bar.py +79 -0
- MatplotLibAPI/BoxViolin.py +69 -0
- MatplotLibAPI/Heatmap.py +113 -0
- MatplotLibAPI/Histogram.py +69 -0
- MatplotLibAPI/Network.py +94 -30
- MatplotLibAPI/Pie.py +66 -0
- MatplotLibAPI/Sankey.py +39 -0
- MatplotLibAPI/StyleTemplate.py +5 -0
- MatplotLibAPI/Sunburst.py +83 -0
- MatplotLibAPI/Waffle.py +82 -0
- MatplotLibAPI/__init__.py +44 -818
- MatplotLibAPI/_typing.py +17 -0
- MatplotLibAPI/_visualization_utils.py +38 -0
- MatplotLibAPI/accessor.py +1647 -0
- matplotlibapi-3.2.16.dist-info/METADATA +269 -0
- matplotlibapi-3.2.16.dist-info/RECORD +26 -0
- matplotlibapi-3.2.14.dist-info/METADATA +0 -31
- matplotlibapi-3.2.14.dist-info/RECORD +0 -14
- {matplotlibapi-3.2.14.dist-info → matplotlibapi-3.2.16.dist-info}/WHEEL +0 -0
- {matplotlibapi-3.2.14.dist-info → matplotlibapi-3.2.16.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/_typing.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Internal type aliases used across MatplotLibAPI."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Callable, Literal, Union
|
|
4
|
+
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
import numpy.typing as npt
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# ``DataFrame.corr`` supports the three built-in correlation methods or a callable
|
|
11
|
+
# that operates on two array-like inputs and returns a float. Using a local alias
|
|
12
|
+
# avoids depending on the private ``pandas._typing`` module, which is not
|
|
13
|
+
# considered stable across releases.
|
|
14
|
+
CorrelationMethod: TypeAlias = Union[
|
|
15
|
+
Literal["pearson", "kendall", "spearman"],
|
|
16
|
+
Callable[[npt.NDArray[Any], npt.NDArray[Any]], float],
|
|
17
|
+
]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Shared utilities for matplotlib-based plotting helpers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Callable, Dict, Optional, Tuple, cast
|
|
4
|
+
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
from numpy import ndarray
|
|
7
|
+
from matplotlib.axes import Axes
|
|
8
|
+
from matplotlib.figure import Figure
|
|
9
|
+
from typing_extensions import Protocol
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class _AplotFunc(Protocol):
|
|
13
|
+
def __call__(self, *, pd_df: Any, ax: Axes, **kwargs: Any) -> Axes: ...
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_axis(ax: Optional[Axes] = None) -> Axes:
|
|
17
|
+
"""Return a Matplotlib axes, defaulting to the current one."""
|
|
18
|
+
return ax if ax is not None else plt.gca()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _wrap_aplot(
|
|
22
|
+
plot_func: _AplotFunc,
|
|
23
|
+
pd_df: Any,
|
|
24
|
+
figsize: Tuple[float, float],
|
|
25
|
+
ax_args: Optional[Dict[str, Any]] = None,
|
|
26
|
+
**kwargs: Any,
|
|
27
|
+
) -> Figure:
|
|
28
|
+
"""Create a new figure and delegate plotting to an axis-level function."""
|
|
29
|
+
ax_args = ax_args or {}
|
|
30
|
+
fig, axes_obj = plt.subplots(figsize=figsize, **ax_args)
|
|
31
|
+
ax: Axes
|
|
32
|
+
if isinstance(axes_obj, Axes):
|
|
33
|
+
ax = axes_obj
|
|
34
|
+
else:
|
|
35
|
+
ax = cast(Axes, axes_obj.flat[0] if isinstance(axes_obj, ndarray) else axes_obj)
|
|
36
|
+
plot_func(pd_df=pd_df, ax=ax, **kwargs)
|
|
37
|
+
fig_obj: Figure = cast(Figure, fig)
|
|
38
|
+
return fig_obj
|