MatplotLibAPI 3.2.21__py3-none-any.whl → 4.0.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.
- MatplotLibAPI/__init__.py +4 -86
- MatplotLibAPI/accessor.py +519 -196
- MatplotLibAPI/area.py +177 -0
- MatplotLibAPI/bar.py +185 -0
- MatplotLibAPI/base_plot.py +88 -0
- MatplotLibAPI/box_violin.py +180 -0
- MatplotLibAPI/bubble.py +568 -0
- MatplotLibAPI/{Composite.py → composite.py} +127 -106
- MatplotLibAPI/heatmap.py +223 -0
- MatplotLibAPI/histogram.py +170 -0
- MatplotLibAPI/mcp/__init__.py +17 -0
- MatplotLibAPI/mcp/metadata.py +90 -0
- MatplotLibAPI/mcp/renderers.py +45 -0
- MatplotLibAPI/mcp_server.py +626 -0
- MatplotLibAPI/network/__init__.py +28 -0
- MatplotLibAPI/network/constants.py +22 -0
- MatplotLibAPI/network/core.py +1360 -0
- MatplotLibAPI/network/plot.py +597 -0
- MatplotLibAPI/network/scaling.py +56 -0
- MatplotLibAPI/pie.py +154 -0
- MatplotLibAPI/pivot.py +274 -0
- MatplotLibAPI/sankey.py +99 -0
- MatplotLibAPI/{StyleTemplate.py → style_template.py} +27 -22
- MatplotLibAPI/sunburst.py +139 -0
- MatplotLibAPI/{Table.py → table.py} +112 -87
- MatplotLibAPI/{Timeserie.py → timeserie.py} +98 -42
- MatplotLibAPI/{Treemap.py → treemap.py} +43 -55
- MatplotLibAPI/typing.py +12 -0
- MatplotLibAPI/{_visualization_utils.py → utils.py} +7 -13
- MatplotLibAPI/waffle.py +173 -0
- MatplotLibAPI/word_cloud.py +489 -0
- {matplotlibapi-3.2.21.dist-info → matplotlibapi-4.0.0.dist-info}/METADATA +98 -9
- matplotlibapi-4.0.0.dist-info/RECORD +36 -0
- {matplotlibapi-3.2.21.dist-info → matplotlibapi-4.0.0.dist-info}/WHEEL +1 -1
- matplotlibapi-4.0.0.dist-info/entry_points.txt +2 -0
- MatplotLibAPI/Area.py +0 -80
- MatplotLibAPI/Bar.py +0 -83
- MatplotLibAPI/BoxViolin.py +0 -75
- MatplotLibAPI/Bubble.py +0 -458
- MatplotLibAPI/Heatmap.py +0 -121
- MatplotLibAPI/Histogram.py +0 -73
- MatplotLibAPI/Network.py +0 -989
- MatplotLibAPI/Pie.py +0 -70
- MatplotLibAPI/Pivot.py +0 -134
- MatplotLibAPI/Sankey.py +0 -46
- MatplotLibAPI/Sunburst.py +0 -89
- MatplotLibAPI/Waffle.py +0 -86
- MatplotLibAPI/Wordcloud.py +0 -373
- MatplotLibAPI/_typing.py +0 -17
- matplotlibapi-3.2.21.dist-info/RECORD +0 -26
- {matplotlibapi-3.2.21.dist-info → matplotlibapi-4.0.0.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/Heatmap.py
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"""Heatmap and correlation matrix helpers."""
|
|
2
|
-
|
|
3
|
-
from typing import Any, Dict, Optional, Sequence, Tuple
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
import pandas as pd
|
|
7
|
-
import seaborn as sns
|
|
8
|
-
from matplotlib.axes import Axes
|
|
9
|
-
from matplotlib.figure import Figure
|
|
10
|
-
|
|
11
|
-
from .StyleTemplate import (
|
|
12
|
-
HEATMAP_STYLE_TEMPLATE,
|
|
13
|
-
StyleTemplate,
|
|
14
|
-
string_formatter,
|
|
15
|
-
validate_dataframe,
|
|
16
|
-
)
|
|
17
|
-
from ._visualization_utils import _get_axis, _wrap_aplot
|
|
18
|
-
from ._typing import CorrelationMethod
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def aplot_heatmap(
|
|
22
|
-
pd_df: pd.DataFrame,
|
|
23
|
-
x: str,
|
|
24
|
-
y: str,
|
|
25
|
-
value: str,
|
|
26
|
-
title: Optional[str] = None,
|
|
27
|
-
style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
|
|
28
|
-
ax: Optional[Axes] = None,
|
|
29
|
-
**kwargs: Any,
|
|
30
|
-
) -> Axes:
|
|
31
|
-
"""Plot a matrix heatmap for multivariate pattern detection."""
|
|
32
|
-
validate_dataframe(pd_df, cols=[x, y, value])
|
|
33
|
-
plot_ax = _get_axis(ax)
|
|
34
|
-
|
|
35
|
-
pivot_df = pd_df.pivot_table(index=y, columns=x, values=value, aggfunc="mean")
|
|
36
|
-
sns.heatmap(pivot_df, cmap=style.palette, ax=plot_ax)
|
|
37
|
-
|
|
38
|
-
plot_ax.set_xlabel(string_formatter(x))
|
|
39
|
-
plot_ax.set_ylabel(string_formatter(y))
|
|
40
|
-
if title:
|
|
41
|
-
plot_ax.set_title(title)
|
|
42
|
-
return plot_ax
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def aplot_correlation_matrix(
|
|
46
|
-
pd_df: pd.DataFrame,
|
|
47
|
-
columns: Optional[Sequence[str]] = None,
|
|
48
|
-
method: CorrelationMethod = "pearson",
|
|
49
|
-
title: Optional[str] = None,
|
|
50
|
-
style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
|
|
51
|
-
ax: Optional[Axes] = None,
|
|
52
|
-
**kwargs: Any,
|
|
53
|
-
) -> Axes:
|
|
54
|
-
"""Plot a correlation matrix heatmap for numeric columns."""
|
|
55
|
-
subset = (
|
|
56
|
-
columns
|
|
57
|
-
if columns is not None
|
|
58
|
-
else pd_df.select_dtypes(include=[np.number]).columns
|
|
59
|
-
)
|
|
60
|
-
if len(subset) == 0:
|
|
61
|
-
raise AttributeError("No numeric columns available for correlation matrix")
|
|
62
|
-
|
|
63
|
-
validate_dataframe(pd_df, cols=list(subset))
|
|
64
|
-
plot_ax = _get_axis(ax)
|
|
65
|
-
|
|
66
|
-
selected: pd.DataFrame = pd_df.loc[:, list(subset)]
|
|
67
|
-
corr = selected.corr(method=method)
|
|
68
|
-
sns.heatmap(corr, cmap=style.palette, annot=True, fmt=".2f", ax=plot_ax)
|
|
69
|
-
if title:
|
|
70
|
-
plot_ax.set_title(title)
|
|
71
|
-
return plot_ax
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def fplot_heatmap(
|
|
75
|
-
pd_df: pd.DataFrame,
|
|
76
|
-
x: str,
|
|
77
|
-
y: str,
|
|
78
|
-
value: str,
|
|
79
|
-
title: Optional[str] = None,
|
|
80
|
-
style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
|
|
81
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
82
|
-
save_path: Optional[str] = None,
|
|
83
|
-
savefig_kwargs: Optional[Dict[str, Any]] = None,
|
|
84
|
-
) -> Figure:
|
|
85
|
-
"""Plot a matrix heatmap on a new figure."""
|
|
86
|
-
return _wrap_aplot(
|
|
87
|
-
aplot_heatmap,
|
|
88
|
-
pd_df=pd_df,
|
|
89
|
-
figsize=figsize,
|
|
90
|
-
x=x,
|
|
91
|
-
y=y,
|
|
92
|
-
value=value,
|
|
93
|
-
title=title,
|
|
94
|
-
style=style,
|
|
95
|
-
save_path=save_path,
|
|
96
|
-
savefig_kwargs=savefig_kwargs,
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def fplot_correlation_matrix(
|
|
101
|
-
pd_df: pd.DataFrame,
|
|
102
|
-
columns: Optional[Sequence[str]] = None,
|
|
103
|
-
method: CorrelationMethod = "pearson",
|
|
104
|
-
title: Optional[str] = None,
|
|
105
|
-
style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
|
|
106
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
107
|
-
save_path: Optional[str] = None,
|
|
108
|
-
savefig_kwargs: Optional[Dict[str, Any]] = None,
|
|
109
|
-
) -> Figure:
|
|
110
|
-
"""Plot a correlation matrix heatmap on a new figure."""
|
|
111
|
-
return _wrap_aplot(
|
|
112
|
-
aplot_correlation_matrix,
|
|
113
|
-
pd_df=pd_df,
|
|
114
|
-
figsize=figsize,
|
|
115
|
-
columns=columns,
|
|
116
|
-
method=method,
|
|
117
|
-
title=title,
|
|
118
|
-
style=style,
|
|
119
|
-
save_path=save_path,
|
|
120
|
-
savefig_kwargs=savefig_kwargs,
|
|
121
|
-
)
|
MatplotLibAPI/Histogram.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"""Histogram and KDE plotting helpers."""
|
|
2
|
-
|
|
3
|
-
from typing import Any, Dict, Optional, Tuple
|
|
4
|
-
|
|
5
|
-
import pandas as pd
|
|
6
|
-
import seaborn as sns
|
|
7
|
-
from matplotlib.axes import Axes
|
|
8
|
-
from matplotlib.figure import Figure
|
|
9
|
-
|
|
10
|
-
from .StyleTemplate import (
|
|
11
|
-
DISTRIBUTION_STYLE_TEMPLATE,
|
|
12
|
-
StyleTemplate,
|
|
13
|
-
string_formatter,
|
|
14
|
-
validate_dataframe,
|
|
15
|
-
)
|
|
16
|
-
from ._visualization_utils import _get_axis, _wrap_aplot
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def aplot_histogram_kde(
|
|
20
|
-
pd_df: pd.DataFrame,
|
|
21
|
-
column: str,
|
|
22
|
-
bins: int = 20,
|
|
23
|
-
kde: bool = True,
|
|
24
|
-
title: Optional[str] = None,
|
|
25
|
-
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
26
|
-
ax: Optional[Axes] = None,
|
|
27
|
-
**kwargs: Any,
|
|
28
|
-
) -> Axes:
|
|
29
|
-
"""Plot a histogram with an optional kernel density estimate."""
|
|
30
|
-
validate_dataframe(pd_df, cols=[column])
|
|
31
|
-
plot_ax = _get_axis(ax)
|
|
32
|
-
|
|
33
|
-
sns.histplot(
|
|
34
|
-
data=pd_df,
|
|
35
|
-
x=column,
|
|
36
|
-
bins=bins,
|
|
37
|
-
kde=kde,
|
|
38
|
-
color=style.font_color,
|
|
39
|
-
edgecolor=style.background_color,
|
|
40
|
-
ax=plot_ax,
|
|
41
|
-
)
|
|
42
|
-
plot_ax.set_facecolor(style.background_color)
|
|
43
|
-
plot_ax.set_xlabel(string_formatter(column))
|
|
44
|
-
plot_ax.set_ylabel("Frequency")
|
|
45
|
-
if title:
|
|
46
|
-
plot_ax.set_title(title)
|
|
47
|
-
return plot_ax
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def fplot_histogram_kde(
|
|
51
|
-
pd_df: pd.DataFrame,
|
|
52
|
-
column: str,
|
|
53
|
-
bins: int = 20,
|
|
54
|
-
kde: bool = True,
|
|
55
|
-
title: Optional[str] = None,
|
|
56
|
-
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
57
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
58
|
-
save_path: Optional[str] = None,
|
|
59
|
-
savefig_kwargs: Optional[Dict[str, Any]] = None,
|
|
60
|
-
) -> Figure:
|
|
61
|
-
"""Plot a histogram with optional KDE on a new figure."""
|
|
62
|
-
return _wrap_aplot(
|
|
63
|
-
aplot_histogram_kde,
|
|
64
|
-
pd_df=pd_df,
|
|
65
|
-
figsize=figsize,
|
|
66
|
-
column=column,
|
|
67
|
-
bins=bins,
|
|
68
|
-
kde=kde,
|
|
69
|
-
title=title,
|
|
70
|
-
style=style,
|
|
71
|
-
save_path=save_path,
|
|
72
|
-
savefig_kwargs=savefig_kwargs,
|
|
73
|
-
)
|