MatplotLibAPI 3.2.3__py3-none-any.whl → 3.2.5__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/Network.py +165 -79
- MatplotLibAPI/__init__.py +204 -184
- {MatplotLibAPI-3.2.3.dist-info → MatplotLibAPI-3.2.5.dist-info}/METADATA +1 -1
- {MatplotLibAPI-3.2.3.dist-info → MatplotLibAPI-3.2.5.dist-info}/RECORD +7 -7
- {MatplotLibAPI-3.2.3.dist-info → MatplotLibAPI-3.2.5.dist-info}/LICENSE +0 -0
- {MatplotLibAPI-3.2.3.dist-info → MatplotLibAPI-3.2.5.dist-info}/WHEEL +0 -0
- {MatplotLibAPI-3.2.3.dist-info → MatplotLibAPI-3.2.5.dist-info}/top_level.txt +0 -0
MatplotLibAPI/Network.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
|
|
5
5
|
|
|
6
6
|
import matplotlib.pyplot as plt
|
|
7
7
|
from matplotlib.axes import Axes
|
|
8
|
+
from matplotlib.figure import Figure
|
|
8
9
|
import seaborn as sns
|
|
9
10
|
import networkx as nx
|
|
10
11
|
import numpy as np
|
|
@@ -13,7 +14,7 @@ from networkx import Graph
|
|
|
13
14
|
from networkx.classes.graph import Graph
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
from .StyleTemplate import StyleTemplate, string_formatter, format_func,validate_dataframe
|
|
17
|
+
from .StyleTemplate import StyleTemplate, string_formatter, format_func, validate_dataframe
|
|
17
18
|
|
|
18
19
|
NETWORK_STYLE_TEMPLATE = StyleTemplate(
|
|
19
20
|
)
|
|
@@ -89,13 +90,14 @@ class EdgeView(nx.classes.reportviews.EdgeView):
|
|
|
89
90
|
return [(edge[0], edge[1]) for edge in filtered_edges]
|
|
90
91
|
|
|
91
92
|
|
|
92
|
-
class
|
|
93
|
+
class networkGraph():
|
|
93
94
|
"""
|
|
94
95
|
Custom graph class based on NetworkX's Graph class.
|
|
95
96
|
"""
|
|
97
|
+
_nx_graph: nx.Graph
|
|
96
98
|
|
|
97
|
-
def __init__(self):
|
|
98
|
-
|
|
99
|
+
def __init__(self, nx_graph: nx.Graph):
|
|
100
|
+
self._nx_graph = nx_graph
|
|
99
101
|
self._scale = 1.0
|
|
100
102
|
|
|
101
103
|
@property
|
|
@@ -108,7 +110,7 @@ class Graph(nx.Graph):
|
|
|
108
110
|
|
|
109
111
|
@property
|
|
110
112
|
def nodes(self):
|
|
111
|
-
return NodeView(self)
|
|
113
|
+
return NodeView(self._nx_graph)
|
|
112
114
|
|
|
113
115
|
@nodes.setter
|
|
114
116
|
def scale(self, value: NodeView):
|
|
@@ -116,21 +118,22 @@ class Graph(nx.Graph):
|
|
|
116
118
|
|
|
117
119
|
@property
|
|
118
120
|
def edges(self):
|
|
119
|
-
return EdgeView(self)
|
|
121
|
+
return EdgeView(self._nx_graph)
|
|
120
122
|
|
|
121
123
|
@property
|
|
122
124
|
def adjacency(self):
|
|
123
|
-
return AdjacencyView(list(self))
|
|
125
|
+
return AdjacencyView(list(self._nx_graph))
|
|
124
126
|
|
|
125
|
-
def edge_subgraph(self, edges: Iterable) ->
|
|
126
|
-
return nx.edge_subgraph(self, edges)
|
|
127
|
+
def edge_subgraph(self, edges: Iterable) -> 'networkGraph':
|
|
128
|
+
return nx.edge_subgraph(self._nx_graph, edges)
|
|
127
129
|
|
|
128
130
|
def layout(self,
|
|
129
131
|
max_node_size: int = DEFAULT["MAX_NODES"],
|
|
130
132
|
min_node_size: int = DEFAULT["MAX_NODES"],
|
|
131
133
|
max_edge_width: int = DEFAULT["MAX_EDGE_WIDTH"],
|
|
132
134
|
max_font_size: int = DEFAULT["MAX_FONT_SIZE"],
|
|
133
|
-
min_font_size: int = DEFAULT["MIN_FONT_SIZE"]
|
|
135
|
+
min_font_size: int = DEFAULT["MIN_FONT_SIZE"],
|
|
136
|
+
weight: str = "weight"):
|
|
134
137
|
"""
|
|
135
138
|
Calculates the sizes for nodes, edges, and fonts based on node weights and edge weights.
|
|
136
139
|
|
|
@@ -144,13 +147,13 @@ class Graph(nx.Graph):
|
|
|
144
147
|
and font sizes for node labels.
|
|
145
148
|
"""
|
|
146
149
|
# Normalize and scale nodes' weights within the desired range of edge widths
|
|
147
|
-
node_weights = [data.get(
|
|
150
|
+
node_weights = [data.get(weight, 1)
|
|
148
151
|
for node, data in self.nodes(data=True)]
|
|
149
152
|
node_size = scale_weights(
|
|
150
153
|
weights=node_weights, scale_max=max_node_size, scale_min=min_node_size)
|
|
151
154
|
|
|
152
155
|
# Normalize and scale edges' weights within the desired range of edge widths
|
|
153
|
-
edge_weights = [data.get(
|
|
156
|
+
edge_weights = [data.get(weight, 1)
|
|
154
157
|
for _, _, data in self.edges(data=True)]
|
|
155
158
|
edges_width = scale_weights(
|
|
156
159
|
weights=edge_weights, scale_max=max_edge_width)
|
|
@@ -165,7 +168,9 @@ class Graph(nx.Graph):
|
|
|
165
168
|
|
|
166
169
|
return node_size, edges_width, fonts_size
|
|
167
170
|
|
|
168
|
-
def subgraph(self,
|
|
171
|
+
def subgraph(self,
|
|
172
|
+
node_list: Optional[List[str]] = None,
|
|
173
|
+
max_edges: int = DEFAULT["MAX_EDGES"]) -> 'networkGraph':
|
|
169
174
|
if node_list is None:
|
|
170
175
|
node_list = self.nodes.sort("weight")[:DEFAULT["MAX_NODES"]]
|
|
171
176
|
connected_subgraph_nodes = list(self.find_connected_subgraph())
|
|
@@ -175,16 +180,18 @@ class Graph(nx.Graph):
|
|
|
175
180
|
subgraph = nx.subgraph(self, nbunch=node_list)
|
|
176
181
|
edges = subgraph.top_k_edges(attribute="weight", k=5).keys()
|
|
177
182
|
subgraph = subgraph.edge_subgraph(list(edges)[:max_edges])
|
|
178
|
-
return
|
|
183
|
+
return networkGraph(subgraph)
|
|
179
184
|
|
|
180
185
|
def plot_network(self,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
title: Optional[str] = None,
|
|
187
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
188
|
+
weight: str = "weight",
|
|
189
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
184
190
|
"""
|
|
185
191
|
Plots the degree distribution of the graph, including a degree rank plot and a degree histogram.
|
|
186
192
|
"""
|
|
187
|
-
degree_sequence = sorted(
|
|
193
|
+
degree_sequence = sorted(
|
|
194
|
+
[d for n, d in self._nx_graph.degree()], reverse=True)
|
|
188
195
|
dmax = max(degree_sequence)
|
|
189
196
|
sns.set_palette(style.palette)
|
|
190
197
|
if ax is None:
|
|
@@ -195,21 +202,22 @@ class Graph(nx.Graph):
|
|
|
195
202
|
max_node_size=DEFAULT["MAX_NODE_SIZE"],
|
|
196
203
|
max_edge_width=DEFAULT["MAX_EDGE_WIDTH"],
|
|
197
204
|
min_font_size=style.font_mapping.get(0),
|
|
198
|
-
max_font_size=style.font_mapping.get(4)
|
|
199
|
-
|
|
205
|
+
max_font_size=style.font_mapping.get(4),
|
|
206
|
+
weight=weight)
|
|
207
|
+
pos = nx.spring_layout(self._nx_graph, k=1)
|
|
200
208
|
# nodes
|
|
201
|
-
nx.draw_networkx_nodes(self,
|
|
209
|
+
nx.draw_networkx_nodes(self._nx_graph,
|
|
202
210
|
pos,
|
|
203
211
|
ax=ax,
|
|
204
212
|
node_size=list(node_sizes),
|
|
205
213
|
node_color=node_sizes,
|
|
206
|
-
cmap=plt.
|
|
214
|
+
cmap=plt.get_cmap(style.palette))
|
|
207
215
|
# edges
|
|
208
|
-
nx.draw_networkx_edges(self,
|
|
216
|
+
nx.draw_networkx_edges(self._nx_graph,
|
|
209
217
|
pos,
|
|
210
218
|
ax=ax,
|
|
211
219
|
edge_color=style.font_color,
|
|
212
|
-
edge_cmap=plt.
|
|
220
|
+
edge_cmap=plt.get_cmap(style.palette),
|
|
213
221
|
width=edge_widths)
|
|
214
222
|
# labels
|
|
215
223
|
for font_size, nodes in font_sizes.items():
|
|
@@ -221,34 +229,37 @@ class Graph(nx.Graph):
|
|
|
221
229
|
font_color=style.font_color,
|
|
222
230
|
labels={n: string_formatter(n) for n in nodes})
|
|
223
231
|
ax.set_facecolor(style.background_color)
|
|
224
|
-
|
|
232
|
+
if title:
|
|
233
|
+
ax.set_title(title, color=style.font_color,
|
|
234
|
+
fontsize=style.font_size*2)
|
|
225
235
|
ax.set_axis_off()
|
|
226
236
|
|
|
227
237
|
return ax
|
|
228
238
|
|
|
229
|
-
def plot_network_components(self,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
239
|
+
def plot_network_components(self,
|
|
240
|
+
node_list: Optional[List] = None,
|
|
241
|
+
scale: int = DEFAULT["GRAPH_SCALE"],
|
|
242
|
+
node_scale: int = DEFAULT["MAX_NODE_SIZE"],
|
|
243
|
+
edge_scale: float = DEFAULT["MAX_EDGE_WIDTH"],
|
|
244
|
+
max_nodes: int = DEFAULT["MAX_NODES"],
|
|
245
|
+
max_edges: int = DEFAULT["MAX_EDGES"],
|
|
246
|
+
plt_title: Optional[str] = "Top keywords"):
|
|
236
247
|
# node_list=self.nodes_circuits(node_list)
|
|
237
248
|
g = self.subgraph(max_edges=max_edges, node_list=node_list)
|
|
238
249
|
connected_components = nx.connected_components(g)
|
|
239
|
-
axes=[]
|
|
250
|
+
axes = []
|
|
240
251
|
for connected_component in connected_components:
|
|
241
252
|
if len(connected_component) > 5:
|
|
242
253
|
connected_component_graph = self.subgraph(max_edges=max_edges,
|
|
243
254
|
node_list=connected_component)
|
|
244
|
-
ax=connected_component_graph.plot_network()
|
|
255
|
+
ax = connected_component_graph.plot_network()
|
|
245
256
|
axes.append(ax)
|
|
246
257
|
return axes
|
|
247
258
|
|
|
248
|
-
def find_connected_subgraph(self):
|
|
259
|
+
def find_connected_subgraph(self) -> 'networkGraph':
|
|
249
260
|
logging.info(f'find_connected_subgraph')
|
|
250
261
|
# Copy the original graph to avoid modifying it
|
|
251
|
-
H = self.copy()
|
|
262
|
+
H = self._nx_graph.copy()
|
|
252
263
|
|
|
253
264
|
# Flag to keep track of whether any node with degree < 2 was removed
|
|
254
265
|
removed_node = True
|
|
@@ -265,7 +276,7 @@ class Graph(nx.Graph):
|
|
|
265
276
|
removed_node = True
|
|
266
277
|
break
|
|
267
278
|
|
|
268
|
-
return H
|
|
279
|
+
return networkGraph(H)
|
|
269
280
|
|
|
270
281
|
def top_k_edges(self, attribute: str, reverse: bool = True, k: int = 5) -> Dict[Any, List[Tuple[Any, Dict]]]:
|
|
271
282
|
"""
|
|
@@ -297,7 +308,7 @@ class Graph(nx.Graph):
|
|
|
297
308
|
def from_pandas_edgelist(df: pd.DataFrame,
|
|
298
309
|
source: str = "source",
|
|
299
310
|
target: str = "target",
|
|
300
|
-
weight: str = "weight") ->
|
|
311
|
+
weight: str = "weight") -> 'networkGraph':
|
|
301
312
|
"""
|
|
302
313
|
Initialize netX instance with a simple dataframe
|
|
303
314
|
|
|
@@ -307,11 +318,12 @@ class Graph(nx.Graph):
|
|
|
307
318
|
:param weight: Name of edges weight column in df_source.
|
|
308
319
|
|
|
309
320
|
"""
|
|
310
|
-
|
|
311
|
-
df, source=source, target=target, edge_attr=weight
|
|
312
|
-
|
|
321
|
+
network_G = nx.from_pandas_edgelist(
|
|
322
|
+
df, source=source, target=target, edge_attr=weight)
|
|
323
|
+
network_G = networkGraph(network_G)
|
|
324
|
+
network_G = network_G.find_connected_subgraph()
|
|
313
325
|
|
|
314
|
-
edge_aggregates =
|
|
326
|
+
edge_aggregates = network_G.top_k_edges(attribute=weight, k=10)
|
|
315
327
|
node_aggregates = {}
|
|
316
328
|
for (u, v), weight_value in edge_aggregates.items():
|
|
317
329
|
if u not in node_aggregates:
|
|
@@ -321,62 +333,136 @@ class Graph(nx.Graph):
|
|
|
321
333
|
node_aggregates[u] += weight_value
|
|
322
334
|
node_aggregates[v] += weight_value
|
|
323
335
|
|
|
324
|
-
nx.set_node_attributes(
|
|
336
|
+
nx.set_node_attributes(network_G, node_aggregates, name=weight)
|
|
325
337
|
|
|
326
|
-
|
|
327
|
-
|
|
338
|
+
network_G = network_G.edge_subgraph(
|
|
339
|
+
edges=network_G.top_k_edges(attribute=weight))
|
|
340
|
+
return networkGraph(network_G)
|
|
328
341
|
|
|
329
342
|
|
|
330
343
|
def aplot_network(pd_df: pd.DataFrame,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
344
|
+
source: str = "source",
|
|
345
|
+
target: str = "target",
|
|
346
|
+
weight: str = "weight",
|
|
347
|
+
title: Optional[str] = None,
|
|
348
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
349
|
+
sort_by: Optional[str] = None,
|
|
350
|
+
ascending: bool = False,
|
|
351
|
+
node_list: Optional[List] = None,
|
|
352
|
+
ax: Optional[Axes] = None) -> Axes:
|
|
340
353
|
if node_list:
|
|
341
|
-
df = pd_df[(pd_df["source"].isin(node_list)) |
|
|
354
|
+
df = pd_df[(pd_df["source"].isin(node_list)) |
|
|
355
|
+
(pd_df["target"].isin(node_list))]
|
|
342
356
|
else:
|
|
343
357
|
df = pd_df
|
|
344
358
|
validate_dataframe(df, cols=[source, target, weight], sort_by=sort_by)
|
|
345
359
|
|
|
346
|
-
graph =
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
360
|
+
graph = networkGraph.from_pandas_edgelist(df,
|
|
361
|
+
source=source,
|
|
362
|
+
target=target,
|
|
363
|
+
weight=weight)
|
|
350
364
|
return graph.plot_network(title=title,
|
|
351
|
-
|
|
352
|
-
|
|
365
|
+
style=style,
|
|
366
|
+
weight=weight,
|
|
367
|
+
ax=ax)
|
|
368
|
+
|
|
353
369
|
|
|
354
370
|
def aplot_network_components(pd_df: pd.DataFrame,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
371
|
+
source: str = "source",
|
|
372
|
+
target: str = "target",
|
|
373
|
+
weight: str = "weight",
|
|
374
|
+
title: Optional[str] = None,
|
|
375
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
376
|
+
sort_by: Optional[str] = None,
|
|
377
|
+
node_list: Optional[List] = None,
|
|
378
|
+
ascending: bool = False,
|
|
379
|
+
ax: Optional[List[Axes]] = None) -> List[Axes]:
|
|
364
380
|
if node_list:
|
|
365
|
-
df = pd_df[(pd_df["source"].isin(node_list)) |
|
|
381
|
+
df = pd_df[(pd_df["source"].isin(node_list)) |
|
|
382
|
+
(pd_df["target"].isin(node_list))]
|
|
366
383
|
else:
|
|
367
384
|
df = pd_df
|
|
368
385
|
validate_dataframe(df, cols=[source, target, weight], sort_by=sort_by)
|
|
369
386
|
|
|
370
|
-
graph =
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
387
|
+
graph = networkGraph.from_pandas_edgelist(df,
|
|
388
|
+
source=source,
|
|
389
|
+
target=target,
|
|
390
|
+
weight=weight)
|
|
374
391
|
connected_components = nx.connected_components(graph)
|
|
375
|
-
axes=[]
|
|
392
|
+
axes = []
|
|
393
|
+
i = 0
|
|
376
394
|
for connected_component in connected_components:
|
|
377
395
|
if len(connected_component) > 5:
|
|
378
|
-
connected_component_graph = graph.subgraph(
|
|
379
|
-
|
|
396
|
+
connected_component_graph = graph.subgraph(
|
|
397
|
+
node_list=connected_component)
|
|
398
|
+
ax = connected_component_graph.plot_network(title=f"{title}::{i}",
|
|
399
|
+
style=style,
|
|
400
|
+
weight=weight,
|
|
401
|
+
ax=ax)
|
|
380
402
|
axes.append(ax)
|
|
403
|
+
i += 1
|
|
381
404
|
return axes
|
|
382
|
-
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def fplot_network(pd_df: pd.DataFrame,
|
|
408
|
+
source: str = "source",
|
|
409
|
+
target: str = "target",
|
|
410
|
+
weight: str = "weight",
|
|
411
|
+
title: Optional[str] = None,
|
|
412
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
413
|
+
sort_by: Optional[str] = None,
|
|
414
|
+
ascending: bool = False,
|
|
415
|
+
node_list: Optional[List] = None,
|
|
416
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Figure:
|
|
417
|
+
fig = plt.figure(figsize=figsize)
|
|
418
|
+
fig.patch.set_facecolor(style.background_color)
|
|
419
|
+
ax = fig.add_subplot()
|
|
420
|
+
ax = aplot_network(pd_df,
|
|
421
|
+
source=source,
|
|
422
|
+
target=target,
|
|
423
|
+
weight=weight,
|
|
424
|
+
title=title,
|
|
425
|
+
style=style,
|
|
426
|
+
sort_by=sort_by,
|
|
427
|
+
ascending=ascending,
|
|
428
|
+
node_list=node_list,
|
|
429
|
+
ax=ax
|
|
430
|
+
)
|
|
431
|
+
return fig
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def fplot_network_components(pd_df: pd.DataFrame,
|
|
435
|
+
source: str = "source",
|
|
436
|
+
target: str = "target",
|
|
437
|
+
weight: str = "weight",
|
|
438
|
+
title: Optional[str] = None,
|
|
439
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
440
|
+
sort_by: Optional[str] = None,
|
|
441
|
+
ascending: bool = False,
|
|
442
|
+
node_list: Optional[List] = None,
|
|
443
|
+
figsize: Tuple[float, float] = (19.2, 10.8)) -> Figure:
|
|
444
|
+
axes = aplot_network_components(pd_df,
|
|
445
|
+
source=source,
|
|
446
|
+
target=target,
|
|
447
|
+
weight=weight,
|
|
448
|
+
title=title,
|
|
449
|
+
style=style,
|
|
450
|
+
sort_by=sort_by,
|
|
451
|
+
ascending=ascending,
|
|
452
|
+
node_list=node_list
|
|
453
|
+
)
|
|
454
|
+
fig = plt.figure(figsize=figsize)
|
|
455
|
+
fig.patch.set_facecolor(style.background_color)
|
|
456
|
+
ax = fig.add_subplot()
|
|
457
|
+
ax = aplot_network(pd_df,
|
|
458
|
+
source=source,
|
|
459
|
+
target=target,
|
|
460
|
+
weight=weight,
|
|
461
|
+
title=title,
|
|
462
|
+
style=style,
|
|
463
|
+
sort_by=sort_by,
|
|
464
|
+
ascending=ascending,
|
|
465
|
+
node_list=node_list,
|
|
466
|
+
ax=ax
|
|
467
|
+
)
|
|
468
|
+
return fig
|
MatplotLibAPI/__init__.py
CHANGED
|
@@ -4,7 +4,7 @@ from .Bubble import aplot_bubble, fplot_bubble, BUBBLE_STYLE_TEMPLATE
|
|
|
4
4
|
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
|
-
from .Network import aplot_network, aplot_network_components, NETWORK_STYLE_TEMPLATE
|
|
7
|
+
from .Network import aplot_network, aplot_network_components, fplot_network, NETWORK_STYLE_TEMPLATE
|
|
8
8
|
from .Treemap import fplot_treemap, TREEMAP_STYLE_TEMPLATE
|
|
9
9
|
from typing import List, Optional, Tuple
|
|
10
10
|
import pandas as pd
|
|
@@ -22,76 +22,76 @@ class DataFrameAccessor:
|
|
|
22
22
|
self._obj = pd_df
|
|
23
23
|
|
|
24
24
|
def aplot_bubble(self,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
38
|
|
|
39
39
|
return aplot_bubble(pd_df=self._obj,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
53
|
|
|
54
54
|
def fplot_bubble(self,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
68
|
|
|
69
69
|
return fplot_bubble(pd_df=self._obj,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
83
|
|
|
84
84
|
def fplot_composite_bubble(self,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
95
|
|
|
96
96
|
return plot_composite_bubble(pd_df=self._obj,
|
|
97
97
|
label=label,
|
|
@@ -105,153 +105,173 @@ class DataFrameAccessor:
|
|
|
105
105
|
sort_by=sort_by,
|
|
106
106
|
ascending=ascending)
|
|
107
107
|
|
|
108
|
-
def
|
|
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,
|
|
108
|
+
def aplot_table(self,
|
|
127
109
|
cols: List[str],
|
|
128
110
|
title: Optional[str] = None,
|
|
129
111
|
style: StyleTemplate = TABLE_STYLE_TEMPLATE,
|
|
130
112
|
max_values: int = 20,
|
|
131
113
|
sort_by: Optional[str] = None,
|
|
132
114
|
ascending: bool = False,
|
|
133
|
-
|
|
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
134
|
|
|
135
135
|
return fplot_table(pd_df=self._obj,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
143
|
|
|
144
144
|
def aplot_timeserie(self,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
155
|
|
|
156
156
|
return aplot_timeserie(pd_df=self._obj,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
167
|
|
|
168
168
|
def fplot_timeserie(self,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
179
|
|
|
180
180
|
return fplot_timeserie(pd_df=self._obj,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
191
|
|
|
192
192
|
def aplot_network(self,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
202
|
|
|
203
|
-
return aplot_network(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
203
|
+
return aplot_network(pd_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
213
|
|
|
214
214
|
def aplot_network_components(self,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
224
|
|
|
225
225
|
return aplot_network_components(df=self._obj,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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_network(self,
|
|
237
|
+
source: str = "source",
|
|
238
|
+
target: str = "target",
|
|
239
|
+
weight: str = "weight",
|
|
240
|
+
title: Optional[str] = None,
|
|
241
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
242
|
+
sort_by: Optional[str] = None,
|
|
243
|
+
ascending: bool = False,
|
|
244
|
+
node_list: Optional[List] = None) -> Axes:
|
|
245
|
+
|
|
246
|
+
return fplot_network(pd_df=self._obj,
|
|
247
|
+
source=source,
|
|
248
|
+
target=target,
|
|
249
|
+
weight=weight,
|
|
250
|
+
title=title,
|
|
251
|
+
style=style,
|
|
252
|
+
sort_by=sort_by,
|
|
253
|
+
ascending=ascending,
|
|
254
|
+
node_list=node_list)
|
|
235
255
|
|
|
236
256
|
def fplot_treemap(self,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
257
|
+
path: str,
|
|
258
|
+
values: str,
|
|
259
|
+
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
260
|
+
title: Optional[str] = None,
|
|
261
|
+
color: Optional[str] = None,
|
|
262
|
+
max_values: int = 100,
|
|
263
|
+
sort_by: Optional[str] = None,
|
|
264
|
+
ascending: bool = False) -> go.Figure:
|
|
245
265
|
return fplot_treemap(pd_df=self._obj,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
266
|
+
path=path,
|
|
267
|
+
values=values,
|
|
268
|
+
title=title,
|
|
269
|
+
style=style,
|
|
270
|
+
color=color,
|
|
271
|
+
max_values=max_values,
|
|
272
|
+
sort_by=sort_by,
|
|
273
|
+
ascending=ascending)
|
|
254
274
|
|
|
255
275
|
|
|
256
|
-
__all__ = ["validate_dataframe", "aplot_bubble", "aplot_timeserie", "aplot_table", "aplot_network", "aplot_network_components",
|
|
276
|
+
__all__ = ["validate_dataframe", "aplot_bubble", "aplot_timeserie", "aplot_table", "aplot_network", "aplot_network_components", "fplot_network",
|
|
257
277
|
"plot_pivotbar", "fplot_treemap", "plot_composite_bubble", "StyleTemplate", "DataFrameAccessor"]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
MatplotLibAPI/Bubble.py,sha256=ZtOTWGAnJ1zy7bjKQ3OF985R-iZHvZOo_rG1dZMbP-Q,5116
|
|
2
2
|
MatplotLibAPI/Composite.py,sha256=ttcgB_6GiZJKTX-Cmai6MEXrpw1_MuLN9uzDj36v7JA,2889
|
|
3
|
-
MatplotLibAPI/Network.py,sha256=
|
|
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=
|
|
10
|
-
MatplotLibAPI-3.2.
|
|
11
|
-
MatplotLibAPI-3.2.
|
|
12
|
-
MatplotLibAPI-3.2.
|
|
13
|
-
MatplotLibAPI-3.2.
|
|
14
|
-
MatplotLibAPI-3.2.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|