MatplotLibAPI 3.2.7__tar.gz → 3.2.8__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.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Composite.py +9 -11
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Treemap.py +38 -14
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/__init__.py +22 -2
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8/MatplotLibAPI.egg-info}/PKG-INFO +1 -1
- {matplotlibapi-3.2.7/MatplotLibAPI.egg-info → matplotlibapi-3.2.8}/PKG-INFO +1 -1
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/pyproject.toml +1 -1
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/LICENSE +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Bubble.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Network.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Pivot.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/StyleTemplate.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Table.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI/Timeserie.py +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI.egg-info/SOURCES.txt +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI.egg-info/dependency_links.txt +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI.egg-info/requires.txt +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/MatplotLibAPI.egg-info/top_level.txt +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/README.md +0 -0
- {matplotlibapi-3.2.7 → matplotlibapi-3.2.8}/setup.cfg +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# Hint for Visual Code Python Interactive window
|
|
2
2
|
# %%
|
|
3
|
-
from typing import Optional, Tuple, List
|
|
3
|
+
from typing import Optional, Tuple, List
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import matplotlib.pyplot as plt
|
|
6
|
-
from matplotlib.pyplot import GridSpec
|
|
7
6
|
from matplotlib.figure import Figure
|
|
8
|
-
from matplotlib.axes import Axes
|
|
9
7
|
import plotly.graph_objects as go
|
|
8
|
+
from plotly.subplots import make_subplots
|
|
10
9
|
from .Bubble import aplot_bubble, BUBBLE_STYLE_TEMPLATE
|
|
11
10
|
from .Table import aplot_table
|
|
12
|
-
from .Treemap import
|
|
11
|
+
from .Treemap import aplot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
13
12
|
from .StyleTemplate import StyleTemplate, format_func, validate_dataframe
|
|
14
13
|
|
|
15
14
|
|
|
@@ -91,7 +90,7 @@ def plot_composite_bubble(
|
|
|
91
90
|
return fig
|
|
92
91
|
|
|
93
92
|
|
|
94
|
-
def
|
|
93
|
+
def plot_composite_treemap(pd_dfs: List[pd.DataFrame],
|
|
95
94
|
path: str,
|
|
96
95
|
values: str,
|
|
97
96
|
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
@@ -101,7 +100,6 @@ def fplot_treemaps(pd_dfs: List[pd.DataFrame],
|
|
|
101
100
|
ascending: bool = False,
|
|
102
101
|
max_values: int = 100) -> go.Figure:
|
|
103
102
|
|
|
104
|
-
trms = []
|
|
105
103
|
num_dimensions = len(pd_dfs)
|
|
106
104
|
if num_dimensions > 0:
|
|
107
105
|
fig = make_subplots(
|
|
@@ -110,9 +108,9 @@ def fplot_treemaps(pd_dfs: List[pd.DataFrame],
|
|
|
110
108
|
specs=[[{'type': 'domain'}] for _ in range(num_dimensions)],
|
|
111
109
|
vertical_spacing=0.02
|
|
112
110
|
)
|
|
113
|
-
current_row =
|
|
111
|
+
current_row = 1
|
|
114
112
|
for pd_df in pd_dfs:
|
|
115
|
-
trm =
|
|
113
|
+
trm = aplot_treemap(pd_df=pd_df,
|
|
116
114
|
path=path,
|
|
117
115
|
values=values,
|
|
118
116
|
title=title,
|
|
@@ -120,7 +118,7 @@ def fplot_treemaps(pd_dfs: List[pd.DataFrame],
|
|
|
120
118
|
color=color,
|
|
121
119
|
sort_by=sort_by,
|
|
122
120
|
ascending=ascending,
|
|
123
|
-
max_values=max_values
|
|
124
|
-
|
|
125
|
-
trms.append(trm)
|
|
121
|
+
max_values=max_values)
|
|
122
|
+
fig.add_trace(trm,row=current_row, col=1)
|
|
126
123
|
current_row += 1
|
|
124
|
+
return fig
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
# %%
|
|
3
3
|
from typing import Optional
|
|
4
4
|
import pandas as pd
|
|
5
|
-
from pandas import CategoricalDtype,BooleanDtype
|
|
5
|
+
from pandas import CategoricalDtype, BooleanDtype
|
|
6
6
|
import plotly.graph_objects as go
|
|
7
7
|
|
|
8
|
-
from .StyleTemplate import StyleTemplate, string_formatter, percent_formatter,validate_dataframe
|
|
9
|
-
|
|
8
|
+
from .StyleTemplate import StyleTemplate, string_formatter, percent_formatter, validate_dataframe
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
TREEMAP_STYLE_TEMPLATE = StyleTemplate(
|
|
@@ -19,16 +18,15 @@ TREEMAP_STYLE_TEMPLATE = StyleTemplate(
|
|
|
19
18
|
)
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
def
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fig: Optional[go.Figure] = None) -> go.Figure:
|
|
21
|
+
def aplot_treemap(pd_df: pd.DataFrame,
|
|
22
|
+
path: str,
|
|
23
|
+
values: str,
|
|
24
|
+
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
25
|
+
title: Optional[str] = None,
|
|
26
|
+
color: Optional[str] = None,
|
|
27
|
+
sort_by: Optional[str] = None,
|
|
28
|
+
ascending: bool = False,
|
|
29
|
+
max_values: int = 100) -> go.Trace:
|
|
32
30
|
cols = [path, values]
|
|
33
31
|
if color:
|
|
34
32
|
cols.append(color)
|
|
@@ -57,7 +55,33 @@ def fplot_treemap(pd_df: pd.DataFrame,
|
|
|
57
55
|
data['marker'] = dict(colorscale="Viridis",
|
|
58
56
|
colors=color_data.to_list())
|
|
59
57
|
|
|
60
|
-
g = go.Treemap(data
|
|
58
|
+
g = go.Treemap(data,
|
|
59
|
+
root_color=style.background_color
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
return g
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def fplot_treemap(pd_df: pd.DataFrame,
|
|
66
|
+
path: str,
|
|
67
|
+
values: str,
|
|
68
|
+
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
69
|
+
title: Optional[str] = None,
|
|
70
|
+
color: Optional[str] = None,
|
|
71
|
+
sort_by: Optional[str] = None,
|
|
72
|
+
ascending: bool = False,
|
|
73
|
+
max_values: int = 100,
|
|
74
|
+
fig: Optional[go.Figure] = None) -> go.Figure:
|
|
75
|
+
|
|
76
|
+
g = aplot_treemap(pd_df=pd_df,
|
|
77
|
+
path=path,
|
|
78
|
+
values=values,
|
|
79
|
+
title=title,
|
|
80
|
+
style=style,
|
|
81
|
+
color=color,
|
|
82
|
+
sort_by=sort_by,
|
|
83
|
+
ascending=ascending,
|
|
84
|
+
max_values=max_values)
|
|
61
85
|
|
|
62
86
|
if not fig:
|
|
63
87
|
fig = go.Figure(g)
|
|
@@ -5,7 +5,7 @@ from .Composite import plot_composite_bubble
|
|
|
5
5
|
from .Timeserie import aplot_timeserie, fplot_timeserie, TIMESERIE_STYLE_TEMPLATE
|
|
6
6
|
from .Table import aplot_table, fplot_table, TABLE_STYLE_TEMPLATE
|
|
7
7
|
from .Network import aplot_network, aplot_network_components, fplot_network, NETWORK_STYLE_TEMPLATE
|
|
8
|
-
from .Treemap import fplot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
8
|
+
from .Treemap import fplot_treemap, aplot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
9
9
|
from typing import List, Optional, Tuple
|
|
10
10
|
import pandas as pd
|
|
11
11
|
from pandas.api.extensions import register_dataframe_accessor
|
|
@@ -274,6 +274,26 @@ class DataFrameAccessor:
|
|
|
274
274
|
max_values=max_values,
|
|
275
275
|
fig=fig)
|
|
276
276
|
|
|
277
|
+
def aplot_treemap(self,
|
|
278
|
+
path: str,
|
|
279
|
+
values: str,
|
|
280
|
+
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
281
|
+
title: Optional[str] = None,
|
|
282
|
+
color: Optional[str] = None,
|
|
283
|
+
sort_by: Optional[str] = None,
|
|
284
|
+
max_values: int = 100,
|
|
285
|
+
ascending: bool = False,
|
|
286
|
+
fig: Optional[go.Figure] = None) -> go.Figure:
|
|
287
|
+
return aplot_treemap(pd_df=self._obj,
|
|
288
|
+
path=path,
|
|
289
|
+
values=values,
|
|
290
|
+
title=title,
|
|
291
|
+
style=style,
|
|
292
|
+
color=color,
|
|
293
|
+
sort_by=sort_by,
|
|
294
|
+
ascending=ascending,
|
|
295
|
+
max_values=max_values)
|
|
296
|
+
|
|
277
297
|
|
|
278
298
|
__all__ = ["validate_dataframe", "aplot_bubble", "aplot_timeserie", "aplot_table", "aplot_network", "aplot_network_components", "fplot_network",
|
|
279
|
-
"plot_pivotbar", "fplot_treemap", "plot_composite_bubble", "StyleTemplate", "DataFrameAccessor"]
|
|
299
|
+
"plot_pivotbar", "fplot_treemap", "aplot_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.8"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python=">=3.7"
|
|
9
9
|
dependencies = ["pandas","matplotlib","networkx","plotly","seaborn","scikit-learn","kaleido","nbformat"]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|