MatplotLibAPI 3.2.1__tar.gz → 3.2.3__tar.gz
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-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Bubble.py +55 -14
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Composite.py +12 -9
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Network.py +2 -2
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Table.py +29 -4
- matplotlibapi-3.2.3/MatplotLibAPI/Timeserie.py +128 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Treemap.py +1 -1
- matplotlibapi-3.2.3/MatplotLibAPI/__init__.py +257 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3/MatplotLibAPI.egg-info}/PKG-INFO +1 -1
- {matplotlibapi-3.2.1/MatplotLibAPI.egg-info → matplotlibapi-3.2.3}/PKG-INFO +1 -1
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/pyproject.toml +1 -1
- matplotlibapi-3.2.1/MatplotLibAPI/Timeserie.py +0 -97
- matplotlibapi-3.2.1/MatplotLibAPI/__init__.py +0 -181
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/LICENSE +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/Pivot.py +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI/StyleTemplate.py +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI.egg-info/SOURCES.txt +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI.egg-info/dependency_links.txt +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI.egg-info/requires.txt +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/MatplotLibAPI.egg-info/top_level.txt +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/README.md +0 -0
- {matplotlibapi-3.2.1 → matplotlibapi-3.2.3}/setup.cfg +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Hint for Visual Code Python Interactive window
|
|
2
2
|
# %%
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Optional, Tuple
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import matplotlib.pyplot as plt
|
|
6
6
|
from matplotlib.axes import Axes
|
|
7
|
+
from matplotlib.figure import Figure
|
|
7
8
|
import seaborn as sns
|
|
8
9
|
|
|
9
|
-
from .StyleTemplate import DynamicFuncFormatter, StyleTemplate, generate_ticks, string_formatter, bmk_formatter, percent_formatter, format_func,validate_dataframe
|
|
10
|
+
from .StyleTemplate import DynamicFuncFormatter, StyleTemplate, generate_ticks, string_formatter, bmk_formatter, percent_formatter, format_func, validate_dataframe
|
|
10
11
|
|
|
11
12
|
BUBBLE_STYLE_TEMPLATE = StyleTemplate(
|
|
12
13
|
format_funcs={"label": string_formatter,
|
|
@@ -18,7 +19,7 @@ BUBBLE_STYLE_TEMPLATE = StyleTemplate(
|
|
|
18
19
|
)
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
def
|
|
22
|
+
def aplot_bubble(
|
|
22
23
|
pd_df: pd.DataFrame,
|
|
23
24
|
label: str,
|
|
24
25
|
x: str,
|
|
@@ -30,6 +31,8 @@ def plot_bubble(
|
|
|
30
31
|
center_to_mean: bool = False,
|
|
31
32
|
sort_by: Optional[str] = None,
|
|
32
33
|
ascending: bool = False,
|
|
34
|
+
hline=False,
|
|
35
|
+
vline=False,
|
|
33
36
|
ax: Optional[Axes] = None):
|
|
34
37
|
|
|
35
38
|
validate_dataframe(pd_df, cols=[label, x, y, z], sort_by=sort_by)
|
|
@@ -92,17 +95,18 @@ def plot_bubble(
|
|
|
92
95
|
which='major',
|
|
93
96
|
colors=style.font_color,
|
|
94
97
|
labelsize=style.font_size)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
if vline:
|
|
99
|
+
ax.vlines(x=x_mean,
|
|
100
|
+
ymin=y_min,
|
|
101
|
+
ymax=y_max,
|
|
102
|
+
linestyle='--',
|
|
103
|
+
colors=style.font_color)
|
|
104
|
+
if hline:
|
|
105
|
+
ax.hlines(y=y_mean,
|
|
106
|
+
xmin=x_min,
|
|
107
|
+
xmax=x_max,
|
|
108
|
+
linestyle='--',
|
|
109
|
+
colors=style.font_color)
|
|
106
110
|
|
|
107
111
|
for index, row in plot_df.iterrows():
|
|
108
112
|
x_value = row[x]
|
|
@@ -121,4 +125,41 @@ def plot_bubble(
|
|
|
121
125
|
return ax
|
|
122
126
|
|
|
123
127
|
|
|
128
|
+
def fplot_bubble(
|
|
129
|
+
pd_df: pd.DataFrame,
|
|
130
|
+
label: str,
|
|
131
|
+
x: str,
|
|
132
|
+
y: str,
|
|
133
|
+
z: str,
|
|
134
|
+
title: Optional[str] = "Test",
|
|
135
|
+
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
136
|
+
max_values: int = BUBBLE_STYLE_TEMPLATE,
|
|
137
|
+
center_to_mean: bool = False,
|
|
138
|
+
sort_by: Optional[str] = None,
|
|
139
|
+
ascending: bool = False,
|
|
140
|
+
hline=False,
|
|
141
|
+
vline=False,
|
|
142
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Figure:
|
|
143
|
+
|
|
144
|
+
fig = plt.figure(figsize=figsize)
|
|
145
|
+
fig.patch.set_facecolor(style.background_color)
|
|
146
|
+
ax = fig.add_subplot()
|
|
147
|
+
ax = aplot_bubble(pd_df=pd_df,
|
|
148
|
+
label=label,
|
|
149
|
+
x=x,
|
|
150
|
+
y=y,
|
|
151
|
+
z=z,
|
|
152
|
+
title=title,
|
|
153
|
+
style=style,
|
|
154
|
+
max_values=max_values,
|
|
155
|
+
center_to_mean=center_to_mean,
|
|
156
|
+
sort_by=sort_by,
|
|
157
|
+
ascending=ascending,
|
|
158
|
+
hline=hline,
|
|
159
|
+
vline=vline,
|
|
160
|
+
ax=ax)
|
|
161
|
+
return fig
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
124
165
|
# endregion
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# Hint for Visual Code Python Interactive window
|
|
2
2
|
# %%
|
|
3
|
-
from typing import Optional, Tuple
|
|
3
|
+
from typing import Optional, Tuple,List,Union, Dict
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import matplotlib.pyplot as plt
|
|
6
|
+
from matplotlib.pyplot import GridSpec
|
|
6
7
|
from matplotlib.figure import Figure
|
|
8
|
+
from matplotlib.axes import Axes
|
|
7
9
|
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
from .Table import plot_table
|
|
10
|
+
from .Bubble import aplot_bubble, BUBBLE_STYLE_TEMPLATE
|
|
11
|
+
from .Table import aplot_table
|
|
11
12
|
from .StyleTemplate import StyleTemplate, format_func, validate_dataframe
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
|
|
14
16
|
def plot_composite_bubble(
|
|
15
17
|
pd_df: pd.DataFrame,
|
|
16
18
|
label: str,
|
|
@@ -38,10 +40,10 @@ def plot_composite_bubble(
|
|
|
38
40
|
style.format_funcs = format_func(
|
|
39
41
|
style.format_funcs, label=label, x=x, y=y, z=z)
|
|
40
42
|
fig = plt.figure(figsize=figsize)
|
|
41
|
-
fig.patch.set_facecolor(
|
|
43
|
+
fig.patch.set_facecolor(style.background_color)
|
|
42
44
|
grid = plt.GridSpec(2, 2, height_ratios=[2, 1], width_ratios=[1, 1])
|
|
43
45
|
ax = fig.add_subplot(grid[0, 0:])
|
|
44
|
-
ax =
|
|
46
|
+
ax = aplot_bubble(pd_df=plot_df,
|
|
45
47
|
label=label,
|
|
46
48
|
x=x,
|
|
47
49
|
y=y,
|
|
@@ -64,7 +66,7 @@ def plot_composite_bubble(
|
|
|
64
66
|
style.format_funcs[z] = style.format_funcs["z"]
|
|
65
67
|
|
|
66
68
|
ax2 = fig.add_subplot(grid[1, 0])
|
|
67
|
-
ax2 =
|
|
69
|
+
ax2 = aplot_table(
|
|
68
70
|
pd_df=plot_df,
|
|
69
71
|
cols=[label, z, y, x],
|
|
70
72
|
title=f"Top {table_rows}",
|
|
@@ -75,10 +77,10 @@ def plot_composite_bubble(
|
|
|
75
77
|
style=style
|
|
76
78
|
)
|
|
77
79
|
ax3 = fig.add_subplot(grid[1, 1])
|
|
78
|
-
ax3 =
|
|
80
|
+
ax3 = aplot_table(
|
|
79
81
|
pd_df=plot_df,
|
|
80
82
|
cols=[label, z, y, x],
|
|
81
|
-
title=f"
|
|
83
|
+
title=f"Last {table_rows}",
|
|
82
84
|
ax=ax3,
|
|
83
85
|
sort_by=sort_by,
|
|
84
86
|
ascending=True,
|
|
@@ -87,3 +89,4 @@ def plot_composite_bubble(
|
|
|
87
89
|
)
|
|
88
90
|
fig.tight_layout()
|
|
89
91
|
return fig
|
|
92
|
+
|
|
@@ -327,7 +327,7 @@ class Graph(nx.Graph):
|
|
|
327
327
|
return Graph(G)
|
|
328
328
|
|
|
329
329
|
|
|
330
|
-
def
|
|
330
|
+
def aplot_network(pd_df: pd.DataFrame,
|
|
331
331
|
source: str = "source",
|
|
332
332
|
target: str = "target",
|
|
333
333
|
weight: str = "weight",
|
|
@@ -351,7 +351,7 @@ def plot_network(pd_df: pd.DataFrame,
|
|
|
351
351
|
style=style,
|
|
352
352
|
ax=ax)
|
|
353
353
|
|
|
354
|
-
def
|
|
354
|
+
def aplot_network_components(pd_df: pd.DataFrame,
|
|
355
355
|
source: str = "source",
|
|
356
356
|
target: str = "target",
|
|
357
357
|
weight: str = "weight",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
1
|
+
from typing import List, Optional, Tuple
|
|
2
2
|
import pandas as pd
|
|
3
3
|
import matplotlib.pyplot as plt
|
|
4
4
|
from matplotlib.axes import Axes
|
|
5
|
+
from matplotlib.figure import Figure
|
|
5
6
|
|
|
6
|
-
from .StyleTemplate import StyleTemplate, string_formatter,validate_dataframe
|
|
7
|
+
from .StyleTemplate import StyleTemplate, string_formatter, validate_dataframe
|
|
7
8
|
|
|
8
9
|
TABLE_STYLE_TEMPLATE = StyleTemplate(
|
|
9
10
|
background_color='black',
|
|
@@ -13,7 +14,7 @@ TABLE_STYLE_TEMPLATE = StyleTemplate(
|
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
def
|
|
17
|
+
def aplot_table(pd_df: pd.DataFrame,
|
|
17
18
|
cols: List[str],
|
|
18
19
|
title: Optional[str] = None,
|
|
19
20
|
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
@@ -23,7 +24,7 @@ def plot_table(pd_df: pd.DataFrame,
|
|
|
23
24
|
ax: Optional[Axes] = None
|
|
24
25
|
) -> Axes:
|
|
25
26
|
validate_dataframe(pd_df, cols=cols, sort_by=sort_by)
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
if not sort_by:
|
|
28
29
|
sort_by = cols[0]
|
|
29
30
|
|
|
@@ -64,3 +65,27 @@ def plot_table(pd_df: pd.DataFrame,
|
|
|
64
65
|
ax.set_title(title, color=style.font_color, fontsize=style.font_size*2)
|
|
65
66
|
ax.title.set_position([0.5, 1.05])
|
|
66
67
|
return ax
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def fplot_table(pd_df: pd.DataFrame,
|
|
71
|
+
cols: List[str],
|
|
72
|
+
title: Optional[str] = None,
|
|
73
|
+
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
74
|
+
max_values: int = 20,
|
|
75
|
+
sort_by: Optional[str] = None,
|
|
76
|
+
ascending: bool = False,
|
|
77
|
+
figsize: Tuple[float, float] = (19.2, 10.8)
|
|
78
|
+
) -> Figure:
|
|
79
|
+
fig = plt.figure(figsize=figsize)
|
|
80
|
+
fig.patch.set_facecolor(style.background_color)
|
|
81
|
+
ax = fig.add_subplot()
|
|
82
|
+
ax = aplot_table(pd_df,
|
|
83
|
+
cols,
|
|
84
|
+
title,
|
|
85
|
+
style,
|
|
86
|
+
max_values,
|
|
87
|
+
sort_by,
|
|
88
|
+
ascending,
|
|
89
|
+
ax
|
|
90
|
+
)
|
|
91
|
+
return fig
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Hint for Visual Code Python Interactive window
|
|
2
|
+
# %%
|
|
3
|
+
from typing import Optional, Tuple
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
from matplotlib.figure import Figure
|
|
7
|
+
from matplotlib.axes import Axes
|
|
8
|
+
import seaborn as sns
|
|
9
|
+
|
|
10
|
+
from .StyleTemplate import DynamicFuncFormatter, StyleTemplate, string_formatter, bmk_formatter, format_func, validate_dataframe
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
TIMESERIE_STYLE_TEMPLATE = StyleTemplate(
|
|
14
|
+
palette='rocket',
|
|
15
|
+
format_funcs={"y": bmk_formatter, "label": string_formatter}
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# region Line
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def aplot_timeserie(pd_df: pd.DataFrame,
|
|
22
|
+
label: str,
|
|
23
|
+
x: str,
|
|
24
|
+
y: str,
|
|
25
|
+
title: Optional[str] = None,
|
|
26
|
+
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
27
|
+
max_values: int = 100,
|
|
28
|
+
sort_by: Optional[str] = None,
|
|
29
|
+
ascending: bool = False,
|
|
30
|
+
std: bool = False,
|
|
31
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
32
|
+
|
|
33
|
+
validate_dataframe(pd_df, cols=[label, x, y], sort_by=sort_by)
|
|
34
|
+
style.format_funcs = format_func(style.format_funcs, label=label, x=x, y=y)
|
|
35
|
+
|
|
36
|
+
df = pd_df[[label, x, y]].sort_values(by=[label, x])
|
|
37
|
+
df[x] = pd.to_datetime(df[x])
|
|
38
|
+
df.set_index(x, inplace=True)
|
|
39
|
+
|
|
40
|
+
sns.set_palette(style.palette)
|
|
41
|
+
# Colors for each group
|
|
42
|
+
colors = sns.color_palette(n_colors=len(df.columns))
|
|
43
|
+
if ax is None:
|
|
44
|
+
ax = plt.gca()
|
|
45
|
+
|
|
46
|
+
# Get unique dimension_types
|
|
47
|
+
label_types = df[label].unique()
|
|
48
|
+
|
|
49
|
+
# Colors for each group
|
|
50
|
+
colors = sns.color_palette(n_colors=len(label_types))
|
|
51
|
+
|
|
52
|
+
for label_type, color in zip(label_types, colors):
|
|
53
|
+
temp_df = df[df[label] == label_type].sort_values(by=x)
|
|
54
|
+
|
|
55
|
+
if style.format_funcs.get("label"):
|
|
56
|
+
label_type = style.format_funcs.get("label")(label_type)
|
|
57
|
+
if std:
|
|
58
|
+
ma = temp_df[y].rolling(window=7, min_periods=1).mean()
|
|
59
|
+
std_dev = temp_df[y].rolling(window=7, min_periods=1).std()
|
|
60
|
+
# Calculate the last moving average value to include in the legend
|
|
61
|
+
last_ma_value = ma.iloc[-1]
|
|
62
|
+
# Dynamically creating the legend label
|
|
63
|
+
label_str = f"{string_formatter(label_type)} (avg 7d: {style.format_funcs[y](last_ma_value)})"
|
|
64
|
+
# Plot moving average and include the last MA value in the label for the legend
|
|
65
|
+
ax.plot(temp_df.index, ma, color=color,
|
|
66
|
+
linestyle='--', label=label_str)
|
|
67
|
+
|
|
68
|
+
ax.fill_between(temp_df.index, ma - std_dev, ma +
|
|
69
|
+
std_dev, color=color, alpha=0.2, label='_nolegend_')
|
|
70
|
+
else:
|
|
71
|
+
label_str = f"{string_formatter(label_type)}"
|
|
72
|
+
# Plot moving average and include the last MA value in the label for the legend
|
|
73
|
+
ax.plot(temp_df.index, temp_df[y], color=color, label=label_str)
|
|
74
|
+
|
|
75
|
+
ax.legend(
|
|
76
|
+
title=label,
|
|
77
|
+
fontsize=style.font_size-4,
|
|
78
|
+
title_fontsize=style.font_size,
|
|
79
|
+
labelcolor='linecolor',
|
|
80
|
+
facecolor=style.background_color)
|
|
81
|
+
|
|
82
|
+
ax.set_xlabel(string_formatter(x), color=style.font_color)
|
|
83
|
+
if style.format_funcs.get("x"):
|
|
84
|
+
ax.xaxis.set_major_formatter(
|
|
85
|
+
DynamicFuncFormatter(style.format_funcs.get("x")))
|
|
86
|
+
ax.tick_params(axis='x', colors=style.font_color,
|
|
87
|
+
labelrotation=45, labelsize=style.font_size-4)
|
|
88
|
+
|
|
89
|
+
ax.set_ylabel(string_formatter(y), color=style.font_color)
|
|
90
|
+
if style.format_funcs.get("y"):
|
|
91
|
+
ax.yaxis.set_major_formatter(
|
|
92
|
+
DynamicFuncFormatter(style.format_funcs.get("y")))
|
|
93
|
+
ax.tick_params(axis='y', colors=style.font_color,
|
|
94
|
+
labelsize=style.font_size-4)
|
|
95
|
+
ax.set_facecolor(style.background_color)
|
|
96
|
+
ax.grid(True)
|
|
97
|
+
if title:
|
|
98
|
+
ax.set_title(title, color=style.font_color, fontsize=style.font_size+4)
|
|
99
|
+
return ax
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def fplot_timeserie(pd_df: pd.DataFrame,
|
|
103
|
+
label: str,
|
|
104
|
+
x: str,
|
|
105
|
+
y: str,
|
|
106
|
+
title: Optional[str] = None,
|
|
107
|
+
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
108
|
+
max_values: int = 100,
|
|
109
|
+
sort_by: Optional[str] = None,
|
|
110
|
+
ascending: bool = False,
|
|
111
|
+
std: bool = False,
|
|
112
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Figure:
|
|
113
|
+
fig = plt.figure(figsize=figsize)
|
|
114
|
+
fig.patch.set_facecolor(style.background_color)
|
|
115
|
+
ax = fig.add_subplot()
|
|
116
|
+
ax = aplot_timeserie(pd_df=pd_df,
|
|
117
|
+
label=label,
|
|
118
|
+
x=x,
|
|
119
|
+
y=y,
|
|
120
|
+
title=title,
|
|
121
|
+
style=style,
|
|
122
|
+
max_values=max_values,
|
|
123
|
+
std=std,
|
|
124
|
+
sort_by=sort_by,
|
|
125
|
+
ascending=ascending,
|
|
126
|
+
ax=ax)
|
|
127
|
+
return fig
|
|
128
|
+
# endregion
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
|
|
2
|
+
from .StyleTemplate import StyleTemplate
|
|
3
|
+
from .Bubble import aplot_bubble, fplot_bubble, BUBBLE_STYLE_TEMPLATE
|
|
4
|
+
from .Composite import plot_composite_bubble
|
|
5
|
+
from .Timeserie import aplot_timeserie, fplot_timeserie, TIMESERIE_STYLE_TEMPLATE
|
|
6
|
+
from .Table import aplot_table, fplot_table, TABLE_STYLE_TEMPLATE
|
|
7
|
+
from .Network import aplot_network, aplot_network_components, NETWORK_STYLE_TEMPLATE
|
|
8
|
+
from .Treemap import fplot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
9
|
+
from typing import List, Optional, Tuple
|
|
10
|
+
import pandas as pd
|
|
11
|
+
from pandas.api.extensions import register_dataframe_accessor
|
|
12
|
+
|
|
13
|
+
from matplotlib.axes import Axes
|
|
14
|
+
from matplotlib.figure import Figure
|
|
15
|
+
import plotly.graph_objects as go
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@register_dataframe_accessor("mpl")
|
|
19
|
+
class DataFrameAccessor:
|
|
20
|
+
|
|
21
|
+
def __init__(self, pd_df: pd.DataFrame):
|
|
22
|
+
self._obj = pd_df
|
|
23
|
+
|
|
24
|
+
def aplot_bubble(self,
|
|
25
|
+
label: str,
|
|
26
|
+
x: str,
|
|
27
|
+
y: str,
|
|
28
|
+
z: str,
|
|
29
|
+
title: Optional[str] = None,
|
|
30
|
+
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
31
|
+
max_values: int = 50,
|
|
32
|
+
center_to_mean: bool = False,
|
|
33
|
+
sort_by: Optional[str] = None,
|
|
34
|
+
ascending: bool = False,
|
|
35
|
+
hline: bool = False,
|
|
36
|
+
vline: bool = False,
|
|
37
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
38
|
+
|
|
39
|
+
return aplot_bubble(pd_df=self._obj,
|
|
40
|
+
label=label,
|
|
41
|
+
x=x,
|
|
42
|
+
y=y,
|
|
43
|
+
z=z,
|
|
44
|
+
title=title,
|
|
45
|
+
style=style,
|
|
46
|
+
max_values=max_values,
|
|
47
|
+
center_to_mean=center_to_mean,
|
|
48
|
+
sort_by=sort_by,
|
|
49
|
+
ascending=ascending,
|
|
50
|
+
hline=hline,
|
|
51
|
+
vline=vline,
|
|
52
|
+
ax=ax)
|
|
53
|
+
|
|
54
|
+
def fplot_bubble(self,
|
|
55
|
+
label: str,
|
|
56
|
+
x: str,
|
|
57
|
+
y: str,
|
|
58
|
+
z: str,
|
|
59
|
+
title: Optional[str] = None,
|
|
60
|
+
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
61
|
+
max_values: int = 50,
|
|
62
|
+
center_to_mean: bool = False,
|
|
63
|
+
sort_by: Optional[str] = None,
|
|
64
|
+
ascending: bool = False,
|
|
65
|
+
hline: bool = False,
|
|
66
|
+
vline: bool = False,
|
|
67
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Figure:
|
|
68
|
+
|
|
69
|
+
return fplot_bubble(pd_df=self._obj,
|
|
70
|
+
label=label,
|
|
71
|
+
x=x,
|
|
72
|
+
y=y,
|
|
73
|
+
z=z,
|
|
74
|
+
title=title,
|
|
75
|
+
style=style,
|
|
76
|
+
max_values=max_values,
|
|
77
|
+
center_to_mean=center_to_mean,
|
|
78
|
+
sort_by=sort_by,
|
|
79
|
+
ascending=ascending,
|
|
80
|
+
hline=hline,
|
|
81
|
+
vline=vline,
|
|
82
|
+
figsize=figsize)
|
|
83
|
+
|
|
84
|
+
def fplot_composite_bubble(self,
|
|
85
|
+
label: str,
|
|
86
|
+
x: str,
|
|
87
|
+
y: str,
|
|
88
|
+
z: str,
|
|
89
|
+
title: Optional[str] = None,
|
|
90
|
+
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
91
|
+
max_values: int = 100,
|
|
92
|
+
center_to_mean: bool = False,
|
|
93
|
+
sort_by: Optional[str] = None,
|
|
94
|
+
ascending: bool = False) -> Figure:
|
|
95
|
+
|
|
96
|
+
return plot_composite_bubble(pd_df=self._obj,
|
|
97
|
+
label=label,
|
|
98
|
+
x=x,
|
|
99
|
+
y=y,
|
|
100
|
+
z=z,
|
|
101
|
+
title=title,
|
|
102
|
+
style=style,
|
|
103
|
+
max_values=max_values,
|
|
104
|
+
center_to_mean=center_to_mean,
|
|
105
|
+
sort_by=sort_by,
|
|
106
|
+
ascending=ascending)
|
|
107
|
+
|
|
108
|
+
def aplot_table_ax(self,
|
|
109
|
+
cols: List[str],
|
|
110
|
+
title: Optional[str] = None,
|
|
111
|
+
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
112
|
+
max_values: int = 20,
|
|
113
|
+
sort_by: Optional[str] = None,
|
|
114
|
+
ascending: bool = False,
|
|
115
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
116
|
+
|
|
117
|
+
return aplot_table(pd_df=self._obj,
|
|
118
|
+
cols=cols,
|
|
119
|
+
title=title,
|
|
120
|
+
style=style,
|
|
121
|
+
max_values=max_values,
|
|
122
|
+
sort_by=sort_by,
|
|
123
|
+
ascending=ascending,
|
|
124
|
+
ax=ax)
|
|
125
|
+
|
|
126
|
+
def fplot_table(self,
|
|
127
|
+
cols: List[str],
|
|
128
|
+
title: Optional[str] = None,
|
|
129
|
+
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
130
|
+
max_values: int = 20,
|
|
131
|
+
sort_by: Optional[str] = None,
|
|
132
|
+
ascending: bool = False,
|
|
133
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Axes:
|
|
134
|
+
|
|
135
|
+
return fplot_table(pd_df=self._obj,
|
|
136
|
+
cols=cols,
|
|
137
|
+
title=title,
|
|
138
|
+
style=style,
|
|
139
|
+
max_values=max_values,
|
|
140
|
+
sort_by=sort_by,
|
|
141
|
+
ascending=ascending,
|
|
142
|
+
figsize=figsize)
|
|
143
|
+
|
|
144
|
+
def aplot_timeserie(self,
|
|
145
|
+
label: str,
|
|
146
|
+
x: str,
|
|
147
|
+
y: str,
|
|
148
|
+
title: Optional[str] = None,
|
|
149
|
+
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
150
|
+
max_values: int = 100,
|
|
151
|
+
sort_by: Optional[str] = None,
|
|
152
|
+
ascending: bool = False,
|
|
153
|
+
std: bool = False,
|
|
154
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
155
|
+
|
|
156
|
+
return aplot_timeserie(pd_df=self._obj,
|
|
157
|
+
label=label,
|
|
158
|
+
x=x,
|
|
159
|
+
y=y,
|
|
160
|
+
title=title,
|
|
161
|
+
style=style,
|
|
162
|
+
max_values=max_values,
|
|
163
|
+
sort_by=sort_by,
|
|
164
|
+
ascending=ascending,
|
|
165
|
+
std=std,
|
|
166
|
+
ax=ax)
|
|
167
|
+
|
|
168
|
+
def fplot_timeserie(self,
|
|
169
|
+
label: str,
|
|
170
|
+
x: str,
|
|
171
|
+
y: str,
|
|
172
|
+
title: Optional[str] = None,
|
|
173
|
+
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
174
|
+
max_values: int = 100,
|
|
175
|
+
sort_by: Optional[str] = None,
|
|
176
|
+
ascending: bool = False,
|
|
177
|
+
std: bool = False,
|
|
178
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Axes:
|
|
179
|
+
|
|
180
|
+
return fplot_timeserie(pd_df=self._obj,
|
|
181
|
+
label=label,
|
|
182
|
+
x=x,
|
|
183
|
+
y=y,
|
|
184
|
+
title=title,
|
|
185
|
+
style=style,
|
|
186
|
+
max_values=max_values,
|
|
187
|
+
sort_by=sort_by,
|
|
188
|
+
ascending=ascending,
|
|
189
|
+
std=std,
|
|
190
|
+
figsize=figsize)
|
|
191
|
+
|
|
192
|
+
def aplot_network(self,
|
|
193
|
+
source: str = "source",
|
|
194
|
+
target: str = "target",
|
|
195
|
+
weight: str = "weight",
|
|
196
|
+
title: Optional[str] = None,
|
|
197
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
198
|
+
sort_by: Optional[str] = None,
|
|
199
|
+
ascending: bool = False,
|
|
200
|
+
node_list: Optional[List] = None,
|
|
201
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
202
|
+
|
|
203
|
+
return aplot_network(df=self._obj,
|
|
204
|
+
source=source,
|
|
205
|
+
target=target,
|
|
206
|
+
weight=weight,
|
|
207
|
+
title=title,
|
|
208
|
+
style=style,
|
|
209
|
+
sort_by=sort_by,
|
|
210
|
+
ascending=ascending,
|
|
211
|
+
node_list=node_list,
|
|
212
|
+
ax=ax)
|
|
213
|
+
|
|
214
|
+
def aplot_network_components(self,
|
|
215
|
+
source: str = "source",
|
|
216
|
+
target: str = "target",
|
|
217
|
+
weight: str = "weight",
|
|
218
|
+
title: Optional[str] = None,
|
|
219
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
220
|
+
sort_by: Optional[str] = None,
|
|
221
|
+
ascending: bool = False,
|
|
222
|
+
node_list: Optional[List] = None,
|
|
223
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
224
|
+
|
|
225
|
+
return aplot_network_components(df=self._obj,
|
|
226
|
+
source=source,
|
|
227
|
+
target=target,
|
|
228
|
+
weight=weight,
|
|
229
|
+
title=title,
|
|
230
|
+
style=style,
|
|
231
|
+
sort_by=sort_by,
|
|
232
|
+
ascending=ascending,
|
|
233
|
+
node_list=node_list,
|
|
234
|
+
ax=ax)
|
|
235
|
+
|
|
236
|
+
def fplot_treemap(self,
|
|
237
|
+
path: str,
|
|
238
|
+
values: str,
|
|
239
|
+
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
240
|
+
title: Optional[str] = None,
|
|
241
|
+
color: Optional[str] = None,
|
|
242
|
+
max_values: int = 100,
|
|
243
|
+
sort_by: Optional[str] = None,
|
|
244
|
+
ascending: bool = False) -> go.Figure:
|
|
245
|
+
return fplot_treemap(pd_df=self._obj,
|
|
246
|
+
path=path,
|
|
247
|
+
values=values,
|
|
248
|
+
title=title,
|
|
249
|
+
style=style,
|
|
250
|
+
color=color,
|
|
251
|
+
max_values=max_values,
|
|
252
|
+
sort_by=sort_by,
|
|
253
|
+
ascending=ascending)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
__all__ = ["validate_dataframe", "aplot_bubble", "aplot_timeserie", "aplot_table", "aplot_network", "aplot_network_components",
|
|
257
|
+
"plot_pivotbar", "fplot_treemap", "plot_composite_bubble", "StyleTemplate", "DataFrameAccessor"]
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
|
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
[project]
|
|
5
5
|
name = "MatplotLibAPI"
|
|
6
|
-
version="v3.2.
|
|
6
|
+
version="v3.2.3"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python=">=3.7"
|
|
9
9
|
dependencies = ["pandas","matplotlib","networkx","plotly","seaborn","scikit-learn","kaleido","nbformat"]
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Hint for Visual Code Python Interactive window
|
|
2
|
-
# %%
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import pandas as pd
|
|
5
|
-
import matplotlib.pyplot as plt
|
|
6
|
-
from matplotlib.axes import Axes
|
|
7
|
-
import seaborn as sns
|
|
8
|
-
|
|
9
|
-
from .StyleTemplate import DynamicFuncFormatter, StyleTemplate, string_formatter, bmk_formatter, format_func,validate_dataframe
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
TIMESERIE_STYLE_TEMPLATE = StyleTemplate(
|
|
13
|
-
palette='rocket',
|
|
14
|
-
format_funcs={"y": bmk_formatter, "label": string_formatter}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
# region Line
|
|
18
|
-
|
|
19
|
-
def plot_timeserie(pd_df: pd.DataFrame,
|
|
20
|
-
label: str,
|
|
21
|
-
x: str,
|
|
22
|
-
y: str,
|
|
23
|
-
title: Optional[str] = None,
|
|
24
|
-
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
25
|
-
max_values: int = 100,
|
|
26
|
-
sort_by: Optional[str] = None,
|
|
27
|
-
ascending: bool = False,
|
|
28
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
29
|
-
|
|
30
|
-
validate_dataframe(pd_df, cols=[label, x, y], sort_by=sort_by)
|
|
31
|
-
style.format_funcs = format_func(style.format_funcs, label=label, x=x, y=y)
|
|
32
|
-
|
|
33
|
-
df = pd_df[[label, x, y]].sort_values(by=[label, x])
|
|
34
|
-
df[x] = pd.to_datetime(df[x])
|
|
35
|
-
df.set_index(x, inplace=True)
|
|
36
|
-
|
|
37
|
-
sns.set_palette(style.palette)
|
|
38
|
-
# Colors for each group
|
|
39
|
-
colors = sns.color_palette(n_colors=len(df.columns))
|
|
40
|
-
if ax is None:
|
|
41
|
-
ax = plt.gca()
|
|
42
|
-
|
|
43
|
-
# Get unique dimension_types
|
|
44
|
-
label_types = df[label].unique()
|
|
45
|
-
|
|
46
|
-
# Colors for each group
|
|
47
|
-
colors = sns.color_palette(n_colors=len(label_types))
|
|
48
|
-
|
|
49
|
-
for label_type, color in zip(label_types, colors):
|
|
50
|
-
temp_df = df[df[label] == label_type].sort_values(by=x)
|
|
51
|
-
|
|
52
|
-
if style.format_funcs.get("label"):
|
|
53
|
-
label_type = style.format_funcs.get("label")(label_type)
|
|
54
|
-
|
|
55
|
-
ma = temp_df[y].rolling(window=7, min_periods=1).mean()
|
|
56
|
-
std_dev = temp_df[y].rolling(window=7, min_periods=1).std()
|
|
57
|
-
|
|
58
|
-
# Calculate the last moving average value to include in the legend
|
|
59
|
-
last_ma_value = ma.iloc[-1]
|
|
60
|
-
|
|
61
|
-
# Dynamically creating the legend label
|
|
62
|
-
label_str = f"{string_formatter(label_type)} (avg 7d: {style.format_funcs[y](last_ma_value)})"
|
|
63
|
-
|
|
64
|
-
# Plot moving average and include the last MA value in the label for the legend
|
|
65
|
-
plt.plot(temp_df.index, ma, color=color,
|
|
66
|
-
linestyle='--', label=label_str)
|
|
67
|
-
plt.fill_between(temp_df.index, ma - std_dev, ma +
|
|
68
|
-
std_dev, color=color, alpha=0.2, label='_nolegend_')
|
|
69
|
-
|
|
70
|
-
ax.legend(
|
|
71
|
-
title=label,
|
|
72
|
-
fontsize=style.font_size-4,
|
|
73
|
-
title_fontsize=style.font_size,
|
|
74
|
-
labelcolor='linecolor',
|
|
75
|
-
facecolor=style.background_color)
|
|
76
|
-
|
|
77
|
-
ax.set_xlabel(string_formatter(x), color=style.font_color)
|
|
78
|
-
if style.format_funcs.get("x"):
|
|
79
|
-
ax.xaxis.set_major_formatter(
|
|
80
|
-
DynamicFuncFormatter(style.format_funcs.get("x")))
|
|
81
|
-
ax.tick_params(axis='x', colors=style.font_color,
|
|
82
|
-
labelrotation=45, labelsize=style.font_size-4)
|
|
83
|
-
|
|
84
|
-
ax.set_ylabel(string_formatter(y), color=style.font_color)
|
|
85
|
-
if style.format_funcs.get("y"):
|
|
86
|
-
ax.yaxis.set_major_formatter(
|
|
87
|
-
DynamicFuncFormatter(style.format_funcs.get("y")))
|
|
88
|
-
ax.tick_params(axis='y', colors=style.font_color,
|
|
89
|
-
labelsize=style.font_size-4)
|
|
90
|
-
ax.set_facecolor(style.background_color)
|
|
91
|
-
ax.grid(True)
|
|
92
|
-
if title:
|
|
93
|
-
ax.set_title(title, color=style.font_color, fontsize=style.font_size+4)
|
|
94
|
-
return ax
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
# endregion
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
from .StyleTemplate import StyleTemplate
|
|
3
|
-
from .Bubble import plot_bubble, BUBBLE_STYLE_TEMPLATE
|
|
4
|
-
from .Composite import plot_composite_bubble
|
|
5
|
-
from .Timeserie import plot_timeserie, TIMESERIE_STYLE_TEMPLATE
|
|
6
|
-
from .Table import plot_table, TABLE_STYLE_TEMPLATE
|
|
7
|
-
from .Network import plot_network, plot_network_components, NETWORK_STYLE_TEMPLATE
|
|
8
|
-
from .Treemap import plot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
9
|
-
from typing import List, Optional
|
|
10
|
-
import pandas as pd
|
|
11
|
-
from pandas.api.extensions import register_dataframe_accessor
|
|
12
|
-
|
|
13
|
-
from matplotlib.axes import Axes
|
|
14
|
-
from matplotlib.figure import Figure
|
|
15
|
-
import plotly.graph_objects as go
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@register_dataframe_accessor("mpl")
|
|
19
|
-
class DataFrameAccessor:
|
|
20
|
-
|
|
21
|
-
def __init__(self, pd_df: pd.DataFrame):
|
|
22
|
-
self._obj = pd_df
|
|
23
|
-
|
|
24
|
-
def plot_bubble(self,
|
|
25
|
-
label: str,
|
|
26
|
-
x: str,
|
|
27
|
-
y: str,
|
|
28
|
-
z: str,
|
|
29
|
-
title: Optional[str] = None,
|
|
30
|
-
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
31
|
-
max_values: int = 50,
|
|
32
|
-
center_to_mean: bool = False,
|
|
33
|
-
sort_by: Optional[str] = None,
|
|
34
|
-
ascending: bool = False,
|
|
35
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
36
|
-
|
|
37
|
-
return plot_bubble(pd_df=self._obj,
|
|
38
|
-
label=label,
|
|
39
|
-
x=x,
|
|
40
|
-
y=y,
|
|
41
|
-
z=z,
|
|
42
|
-
title=title,
|
|
43
|
-
style=style,
|
|
44
|
-
max_values=max_values,
|
|
45
|
-
center_to_mean=center_to_mean,
|
|
46
|
-
sort_by=sort_by,
|
|
47
|
-
ascending=ascending,
|
|
48
|
-
ax=ax)
|
|
49
|
-
|
|
50
|
-
def plot_composite_bubble(self,
|
|
51
|
-
label: str,
|
|
52
|
-
x: str,
|
|
53
|
-
y: str,
|
|
54
|
-
z: str,
|
|
55
|
-
title: Optional[str] = None,
|
|
56
|
-
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
57
|
-
max_values: int = 100,
|
|
58
|
-
center_to_mean: bool = False,
|
|
59
|
-
sort_by: Optional[str] = None,
|
|
60
|
-
ascending: bool = False,
|
|
61
|
-
ax: Optional[Axes] = None) -> Figure:
|
|
62
|
-
|
|
63
|
-
return plot_composite_bubble(pd_df=self._obj,
|
|
64
|
-
label=label,
|
|
65
|
-
x=x,
|
|
66
|
-
y=y,
|
|
67
|
-
z=z,
|
|
68
|
-
title=title,
|
|
69
|
-
style=style,
|
|
70
|
-
max_values=max_values,
|
|
71
|
-
center_to_mean=center_to_mean,
|
|
72
|
-
sort_by=sort_by,
|
|
73
|
-
ascending=ascending,
|
|
74
|
-
ax=ax)
|
|
75
|
-
|
|
76
|
-
def plot_table(self,
|
|
77
|
-
cols: List[str],
|
|
78
|
-
title: Optional[str] = None,
|
|
79
|
-
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
80
|
-
max_values: int = 20,
|
|
81
|
-
sort_by: Optional[str] = None,
|
|
82
|
-
ascending: bool = False,
|
|
83
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
84
|
-
|
|
85
|
-
return plot_table(pd_df=self._obj,
|
|
86
|
-
cols=cols,
|
|
87
|
-
title=title,
|
|
88
|
-
style=style,
|
|
89
|
-
max_values=max_values,
|
|
90
|
-
sort_by=sort_by,
|
|
91
|
-
ascending=ascending,
|
|
92
|
-
ax=ax)
|
|
93
|
-
|
|
94
|
-
def plot_timeserie(self,
|
|
95
|
-
label: str,
|
|
96
|
-
x: str,
|
|
97
|
-
y: str,
|
|
98
|
-
title: Optional[str] = None,
|
|
99
|
-
style: StyleTemplate = TIMESERIE_STYLE_TEMPLATE,
|
|
100
|
-
max_values: int = 100,
|
|
101
|
-
sort_by: Optional[str] = None,
|
|
102
|
-
ascending: bool = False,
|
|
103
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
104
|
-
|
|
105
|
-
return plot_timeserie(pd_df=self._obj,
|
|
106
|
-
label=label,
|
|
107
|
-
x=x,
|
|
108
|
-
y=y,
|
|
109
|
-
title=title,
|
|
110
|
-
style=style,
|
|
111
|
-
max_values=max_values,
|
|
112
|
-
sort_by=sort_by,
|
|
113
|
-
ascending=ascending,
|
|
114
|
-
ax=ax)
|
|
115
|
-
|
|
116
|
-
def plot_network(self,
|
|
117
|
-
source: str = "source",
|
|
118
|
-
target: str = "target",
|
|
119
|
-
weight: str = "weight",
|
|
120
|
-
title: Optional[str] = None,
|
|
121
|
-
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
122
|
-
sort_by: Optional[str] = None,
|
|
123
|
-
ascending: bool = False,
|
|
124
|
-
node_list: Optional[List] = None,
|
|
125
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
126
|
-
|
|
127
|
-
return plot_network(df=self._obj,
|
|
128
|
-
source=source,
|
|
129
|
-
target=target,
|
|
130
|
-
weight=weight,
|
|
131
|
-
title=title,
|
|
132
|
-
style=style,
|
|
133
|
-
sort_by=sort_by,
|
|
134
|
-
ascending=ascending,
|
|
135
|
-
node_list=node_list,
|
|
136
|
-
ax=ax)
|
|
137
|
-
|
|
138
|
-
def plot_network_components(self,
|
|
139
|
-
source: str = "source",
|
|
140
|
-
target: str = "target",
|
|
141
|
-
weight: str = "weight",
|
|
142
|
-
title: Optional[str] = None,
|
|
143
|
-
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
144
|
-
sort_by: Optional[str] = None,
|
|
145
|
-
ascending: bool = False,
|
|
146
|
-
node_list: Optional[List] = None,
|
|
147
|
-
ax: Optional[Axes] = None) -> Axes:
|
|
148
|
-
|
|
149
|
-
return plot_network_components(df=self._obj,
|
|
150
|
-
source=source,
|
|
151
|
-
target=target,
|
|
152
|
-
weight=weight,
|
|
153
|
-
title=title,
|
|
154
|
-
style=style,
|
|
155
|
-
sort_by=sort_by,
|
|
156
|
-
ascending=ascending,
|
|
157
|
-
node_list=node_list,
|
|
158
|
-
ax=ax)
|
|
159
|
-
|
|
160
|
-
def plot_treemap(self,
|
|
161
|
-
path: str,
|
|
162
|
-
values: str,
|
|
163
|
-
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
164
|
-
title: Optional[str] = None,
|
|
165
|
-
color: Optional[str] = None,
|
|
166
|
-
max_values: int = 100,
|
|
167
|
-
sort_by: Optional[str] = None,
|
|
168
|
-
ascending: bool = False) -> go.Figure:
|
|
169
|
-
return plot_treemap(pd_df=self._obj,
|
|
170
|
-
path=path,
|
|
171
|
-
values=values,
|
|
172
|
-
title=title,
|
|
173
|
-
style=style,
|
|
174
|
-
color=color,
|
|
175
|
-
max_values=max_values,
|
|
176
|
-
sort_by=sort_by,
|
|
177
|
-
ascending=ascending)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
__all__ = ["validate_dataframe", "plot_bubble", "plot_timeserie", "plot_table", "plot_network", "plot_network_components",
|
|
181
|
-
"plot_pivotbar", "plot_treemap", "plot_composite_bubble", "StyleTemplate", "DataFrameAccessor"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|