MatplotLibAPI 3.2.5__py3-none-any.whl → 3.2.7__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.
@@ -1,18 +1,18 @@
1
1
  # Hint for Visual Code Python Interactive window
2
2
  # %%
3
- from typing import Optional, Tuple,List,Union, Dict
3
+ from typing import Optional, Tuple, List, Union, Dict
4
4
  import pandas as pd
5
5
  import matplotlib.pyplot as plt
6
6
  from matplotlib.pyplot import GridSpec
7
7
  from matplotlib.figure import Figure
8
8
  from matplotlib.axes import Axes
9
-
9
+ import plotly.graph_objects as go
10
10
  from .Bubble import aplot_bubble, BUBBLE_STYLE_TEMPLATE
11
11
  from .Table import aplot_table
12
+ from .Treemap import fplot_treemap, TREEMAP_STYLE_TEMPLATE
12
13
  from .StyleTemplate import StyleTemplate, format_func, validate_dataframe
13
14
 
14
15
 
15
-
16
16
  def plot_composite_bubble(
17
17
  pd_df: pd.DataFrame,
18
18
  label: str,
@@ -44,17 +44,17 @@ def plot_composite_bubble(
44
44
  grid = plt.GridSpec(2, 2, height_ratios=[2, 1], width_ratios=[1, 1])
45
45
  ax = fig.add_subplot(grid[0, 0:])
46
46
  ax = aplot_bubble(pd_df=plot_df,
47
- label=label,
48
- x=x,
49
- y=y,
50
- z=z,
51
- title=title,
52
- style=style,
53
- max_values=max_values,
54
- center_to_mean=center_to_mean,
55
- sort_by=sort_by,
56
- ascending=ascending,
57
- ax=ax)
47
+ label=label,
48
+ x=x,
49
+ y=y,
50
+ z=z,
51
+ title=title,
52
+ style=style,
53
+ max_values=max_values,
54
+ center_to_mean=center_to_mean,
55
+ sort_by=sort_by,
56
+ ascending=ascending,
57
+ ax=ax)
58
58
 
59
59
  if "label" in style.format_funcs:
60
60
  style.format_funcs[label] = style.format_funcs["label"]
@@ -90,3 +90,37 @@ def plot_composite_bubble(
90
90
  fig.tight_layout()
91
91
  return fig
92
92
 
93
+
94
+ def fplot_treemaps(pd_dfs: List[pd.DataFrame],
95
+ path: str,
96
+ values: str,
97
+ style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
98
+ title: Optional[str] = None,
99
+ color: Optional[str] = None,
100
+ sort_by: Optional[str] = None,
101
+ ascending: bool = False,
102
+ max_values: int = 100) -> go.Figure:
103
+
104
+ trms = []
105
+ num_dimensions = len(pd_dfs)
106
+ if num_dimensions > 0:
107
+ fig = make_subplots(
108
+ rows=num_dimensions,
109
+ cols=1,
110
+ specs=[[{'type': 'domain'}] for _ in range(num_dimensions)],
111
+ vertical_spacing=0.02
112
+ )
113
+ current_row = 0
114
+ for pd_df in pd_dfs:
115
+ trm = fplot_treemap(pd_df=pd_df,
116
+ path=path,
117
+ values=values,
118
+ title=title,
119
+ style=style,
120
+ color=color,
121
+ sort_by=sort_by,
122
+ ascending=ascending,
123
+ max_values=max_values,
124
+ fig=fig)
125
+ trms.append(trm)
126
+ current_row += 1
MatplotLibAPI/__init__.py CHANGED
@@ -106,13 +106,13 @@ class DataFrameAccessor:
106
106
  ascending=ascending)
107
107
 
108
108
  def aplot_table(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:
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
116
 
117
117
  return aplot_table(pd_df=self._obj,
118
118
  cols=cols,
@@ -259,18 +259,20 @@ class DataFrameAccessor:
259
259
  style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
260
260
  title: Optional[str] = None,
261
261
  color: Optional[str] = None,
262
- max_values: int = 100,
263
262
  sort_by: Optional[str] = None,
264
- ascending: bool = False) -> go.Figure:
263
+ max_values: int = 100,
264
+ ascending: bool = False,
265
+ fig: Optional[go.Figure] = None) -> go.Figure:
265
266
  return fplot_treemap(pd_df=self._obj,
266
267
  path=path,
267
268
  values=values,
268
269
  title=title,
269
270
  style=style,
270
271
  color=color,
271
- max_values=max_values,
272
272
  sort_by=sort_by,
273
- ascending=ascending)
273
+ ascending=ascending,
274
+ max_values=max_values,
275
+ fig=fig)
274
276
 
275
277
 
276
278
  __all__ = ["validate_dataframe", "aplot_bubble", "aplot_timeserie", "aplot_table", "aplot_network", "aplot_network_components", "fplot_network",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MatplotLibAPI
3
- Version: 3.2.5
3
+ Version: 3.2.7
4
4
  Requires-Python: >=3.7
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,14 +1,14 @@
1
1
  MatplotLibAPI/Bubble.py,sha256=ZtOTWGAnJ1zy7bjKQ3OF985R-iZHvZOo_rG1dZMbP-Q,5116
2
- MatplotLibAPI/Composite.py,sha256=ttcgB_6GiZJKTX-Cmai6MEXrpw1_MuLN9uzDj36v7JA,2889
2
+ MatplotLibAPI/Composite.py,sha256=AolGqsz5brc9bx4lfp9phWTfFpdlXMq4hrAGkJHJmfQ,4268
3
3
  MatplotLibAPI/Network.py,sha256=zzizLBAMD-nV-1WGZTIoOQn3SVsvr9R8Ba2DTCyuTvA,18790
4
4
  MatplotLibAPI/Pivot.py,sha256=Bo7ZpkxqoE75e8vpSsKIT5X2Q7lLdfAyy46ox1fARbc,7183
5
5
  MatplotLibAPI/StyleTemplate.py,sha256=va8_yXaun1RnjQUOEHGvsXJrKWHdzz4BhnY0CkROLW8,4599
6
6
  MatplotLibAPI/Table.py,sha256=p_nHXRiC6dneBSf0j5nx-hBijBSXd7NBLmdBicFUGqQ,2809
7
7
  MatplotLibAPI/Timeserie.py,sha256=B03xjcBCgWVpkDQKvoyGtNjm6OLtCo1fINyXJrXeWM8,4952
8
8
  MatplotLibAPI/Treemap.py,sha256=1QqBnV1EUzDHPSnp90n3TQKLZMuTymaJFZIdVJQqdjI,2553
9
- MatplotLibAPI/__init__.py,sha256=ffrsuKX4n_eLcCV8YZuSKyCkPbXvCng5wgNI9XUijfw,11928
10
- MatplotLibAPI-3.2.5.dist-info/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
11
- MatplotLibAPI-3.2.5.dist-info/METADATA,sha256=dkn6Fpfe9Yzx9gyQrisQXTeQAu9GLhrFPiSztwyMf7Y,462
12
- MatplotLibAPI-3.2.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- MatplotLibAPI-3.2.5.dist-info/top_level.txt,sha256=MrzbBjDEW48Vb6YhQIqpFYGOhHzQnEIM5Qy2xy2iqew,14
14
- MatplotLibAPI-3.2.5.dist-info/RECORD,,
9
+ MatplotLibAPI/__init__.py,sha256=X_BhQQMYO-CLmsYf1_9eLnjZs3B2TzjfYZqxQCkyyPc,12000
10
+ MatplotLibAPI-3.2.7.dist-info/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
11
+ MatplotLibAPI-3.2.7.dist-info/METADATA,sha256=bri6ND9ICIsgmLhQJL3XxaePkCpBYboaqk2QZ1RqAJI,462
12
+ MatplotLibAPI-3.2.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ MatplotLibAPI-3.2.7.dist-info/top_level.txt,sha256=MrzbBjDEW48Vb6YhQIqpFYGOhHzQnEIM5Qy2xy2iqew,14
14
+ MatplotLibAPI-3.2.7.dist-info/RECORD,,