MatplotLibAPI 3.3.0__py3-none-any.whl → 4.0.1__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 +288 -191
- MatplotLibAPI/area.py +235 -0
- MatplotLibAPI/bar.py +193 -0
- MatplotLibAPI/base_plot.py +88 -0
- MatplotLibAPI/box_violin.py +186 -0
- MatplotLibAPI/bubble.py +569 -0
- MatplotLibAPI/{Composite.py → composite.py} +70 -83
- MatplotLibAPI/heatmap.py +246 -0
- MatplotLibAPI/histogram.py +172 -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.py → network/core.py} +347 -809
- MatplotLibAPI/network/plot.py +597 -0
- MatplotLibAPI/network/scaling.py +56 -0
- MatplotLibAPI/pie.py +155 -0
- MatplotLibAPI/pivot.py +282 -0
- MatplotLibAPI/sankey.py +99 -0
- MatplotLibAPI/{StyleTemplate.py → style_template.py} +8 -4
- MatplotLibAPI/sunburst.py +139 -0
- MatplotLibAPI/{Table.py → table.py} +109 -93
- MatplotLibAPI/{Timeserie.py → timeserie.py} +99 -42
- MatplotLibAPI/{Treemap.py → treemap.py} +43 -55
- MatplotLibAPI/typing.py +12 -0
- MatplotLibAPI/{_visualization_utils.py → utils.py} +30 -13
- MatplotLibAPI/waffle.py +174 -0
- MatplotLibAPI/{Wordcloud.py → word_cloud.py} +188 -88
- {matplotlibapi-3.3.0.dist-info → matplotlibapi-4.0.1.dist-info}/METADATA +98 -9
- matplotlibapi-4.0.1.dist-info/RECORD +36 -0
- {matplotlibapi-3.3.0.dist-info → matplotlibapi-4.0.1.dist-info}/WHEEL +1 -1
- matplotlibapi-4.0.1.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 -460
- MatplotLibAPI/Heatmap.py +0 -121
- MatplotLibAPI/Histogram.py +0 -73
- 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/_typing.py +0 -17
- matplotlibapi-3.3.0.dist-info/RECORD +0 -26
- {matplotlibapi-3.3.0.dist-info → matplotlibapi-4.0.1.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/accessor.py
CHANGED
|
@@ -1,39 +1,17 @@
|
|
|
1
1
|
"""Pandas accessor exposing MatplotLibAPI plotting helpers."""
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
|
|
4
6
|
|
|
5
7
|
import numpy as np
|
|
6
8
|
import pandas as pd
|
|
7
|
-
import plotly.graph_objects as go
|
|
8
9
|
from matplotlib.axes import Axes
|
|
9
10
|
from matplotlib.figure import Figure
|
|
10
11
|
from pandas.api.extensions import register_dataframe_accessor
|
|
11
12
|
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
from .BoxViolin import aplot_box_violin, fplot_box_violin
|
|
15
|
-
from .Bubble import BUBBLE_STYLE_TEMPLATE, aplot_bubble, fplot_bubble
|
|
16
|
-
from .Composite import plot_composite_bubble, plot_composite_treemap
|
|
17
|
-
from .Heatmap import (
|
|
18
|
-
HEATMAP_STYLE_TEMPLATE,
|
|
19
|
-
aplot_correlation_matrix,
|
|
20
|
-
aplot_heatmap,
|
|
21
|
-
fplot_correlation_matrix,
|
|
22
|
-
fplot_heatmap,
|
|
23
|
-
)
|
|
24
|
-
from .Histogram import aplot_histogram_kde, fplot_histogram_kde
|
|
25
|
-
from .Network import (
|
|
26
|
-
NETWORK_STYLE_TEMPLATE,
|
|
27
|
-
aplot_network,
|
|
28
|
-
aplot_network_node,
|
|
29
|
-
aplot_network_components,
|
|
30
|
-
fplot_network_node,
|
|
31
|
-
fplot_network_components,
|
|
32
|
-
fplot_network,
|
|
33
|
-
)
|
|
34
|
-
from .Pie import aplot_pie_donut, fplot_pie_donut
|
|
35
|
-
from .Sankey import SANKEY_STYLE_TEMPLATE, fplot_sankey
|
|
36
|
-
from .StyleTemplate import (
|
|
13
|
+
from .base_plot import BasePlot
|
|
14
|
+
from .style_template import (
|
|
37
15
|
FIG_SIZE,
|
|
38
16
|
AREA_STYLE_TEMPLATE,
|
|
39
17
|
DISTRIBUTION_STYLE_TEMPLATE,
|
|
@@ -43,19 +21,198 @@ from .StyleTemplate import (
|
|
|
43
21
|
TREEMAP_STYLE_TEMPLATE,
|
|
44
22
|
StyleTemplate,
|
|
45
23
|
)
|
|
46
|
-
from .
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
24
|
+
from .typing import CorrelationMethod
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
import plotly.graph_objects as go
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _bubble_imports() -> tuple[StyleTemplate, type]:
|
|
31
|
+
from .bubble import BUBBLE_STYLE_TEMPLATE, Bubble
|
|
32
|
+
|
|
33
|
+
return BUBBLE_STYLE_TEMPLATE, Bubble
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _heatmap_imports() -> tuple[StyleTemplate, Any, Any, Any, Any]:
|
|
37
|
+
from .heatmap import (
|
|
38
|
+
HEATMAP_STYLE_TEMPLATE,
|
|
39
|
+
aplot_correlation_matrix,
|
|
40
|
+
aplot_heatmap,
|
|
41
|
+
fplot_correlation_matrix,
|
|
42
|
+
fplot_heatmap,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
HEATMAP_STYLE_TEMPLATE,
|
|
47
|
+
aplot_correlation_matrix,
|
|
48
|
+
aplot_heatmap,
|
|
49
|
+
fplot_correlation_matrix,
|
|
50
|
+
fplot_heatmap,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _network_imports() -> tuple[StyleTemplate, Any, Any, Any, Any, Any, Any]:
|
|
55
|
+
from .network import (
|
|
56
|
+
NETWORK_STYLE_TEMPLATE,
|
|
57
|
+
aplot_network,
|
|
58
|
+
aplot_network_node,
|
|
59
|
+
aplot_network_components,
|
|
60
|
+
fplot_network,
|
|
61
|
+
fplot_network_node,
|
|
62
|
+
fplot_network_components,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
NETWORK_STYLE_TEMPLATE,
|
|
67
|
+
aplot_network,
|
|
68
|
+
aplot_network_node,
|
|
69
|
+
aplot_network_components,
|
|
70
|
+
fplot_network,
|
|
71
|
+
fplot_network_node,
|
|
72
|
+
fplot_network_components,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _wordcloud_imports() -> tuple[StyleTemplate, Any, Any]:
|
|
77
|
+
from .word_cloud import WORDCLOUD_STYLE_TEMPLATE, aplot_wordcloud, fplot_wordcloud
|
|
78
|
+
|
|
79
|
+
return WORDCLOUD_STYLE_TEMPLATE, aplot_wordcloud, fplot_wordcloud
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _sankey_imports() -> tuple[StyleTemplate, Any]:
|
|
83
|
+
from .sankey import SANKEY_STYLE_TEMPLATE, fplot_sankey
|
|
84
|
+
|
|
85
|
+
return SANKEY_STYLE_TEMPLATE, fplot_sankey
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def aplot_area(*args: Any, **kwargs: Any) -> Axes:
|
|
89
|
+
from .area import aplot_area as _aplot_area
|
|
90
|
+
|
|
91
|
+
return _aplot_area(*args, **kwargs)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def fplot_area(*args: Any, **kwargs: Any) -> Figure:
|
|
95
|
+
from .area import fplot_area as _fplot_area
|
|
96
|
+
|
|
97
|
+
return _fplot_area(*args, **kwargs)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def aplot_bar(*args: Any, **kwargs: Any) -> Axes:
|
|
101
|
+
from .bar import aplot_bar as _aplot_bar
|
|
102
|
+
|
|
103
|
+
return _aplot_bar(*args, **kwargs)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def fplot_bar(*args: Any, **kwargs: Any) -> Figure:
|
|
107
|
+
from .bar import fplot_bar as _fplot_bar
|
|
108
|
+
|
|
109
|
+
return _fplot_bar(*args, **kwargs)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def aplot_box_violin(*args: Any, **kwargs: Any) -> Axes:
|
|
113
|
+
from .box_violin import aplot_box_violin as _aplot_box_violin
|
|
114
|
+
|
|
115
|
+
return _aplot_box_violin(*args, **kwargs)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def fplot_box_violin(*args: Any, **kwargs: Any) -> Figure:
|
|
119
|
+
from .box_violin import fplot_box_violin as _fplot_box_violin
|
|
120
|
+
|
|
121
|
+
return _fplot_box_violin(*args, **kwargs)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def aplot_histogram(*args: Any, **kwargs: Any) -> Axes:
|
|
125
|
+
from .histogram import aplot_histogram as _aplot_histogram
|
|
126
|
+
|
|
127
|
+
return _aplot_histogram(*args, **kwargs)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def fplot_histogram(*args: Any, **kwargs: Any) -> Figure:
|
|
131
|
+
from .histogram import fplot_histogram as _fplot_histogram
|
|
132
|
+
|
|
133
|
+
return _fplot_histogram(*args, **kwargs)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def aplot_pie_donut(*args: Any, **kwargs: Any) -> Axes:
|
|
137
|
+
from .pie import aplot_pie as _aplot_pie_donut
|
|
138
|
+
|
|
139
|
+
return _aplot_pie_donut(*args, **kwargs)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def fplot_pie_donut(*args: Any, **kwargs: Any) -> Figure:
|
|
143
|
+
from .pie import fplot_pie as _fplot_pie_donut
|
|
144
|
+
|
|
145
|
+
return _fplot_pie_donut(*args, **kwargs)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def aplot_table(*args: Any, **kwargs: Any) -> Axes:
|
|
149
|
+
from .table import aplot_table as _aplot_table
|
|
150
|
+
|
|
151
|
+
return _aplot_table(*args, **kwargs)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def fplot_table(*args: Any, **kwargs: Any) -> Figure:
|
|
155
|
+
from .table import fplot_table as _fplot_table
|
|
156
|
+
|
|
157
|
+
return _fplot_table(*args, **kwargs)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def aplot_timeserie(*args: Any, **kwargs: Any) -> Axes:
|
|
161
|
+
from .timeserie import aplot_timeserie as _aplot_timeserie
|
|
162
|
+
|
|
163
|
+
return _aplot_timeserie(*args, **kwargs)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def fplot_timeserie(*args: Any, **kwargs: Any) -> Figure:
|
|
167
|
+
from .timeserie import fplot_timeserie as _fplot_timeserie
|
|
168
|
+
|
|
169
|
+
return _fplot_timeserie(*args, **kwargs)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def aplot_waffle(*args: Any, **kwargs: Any) -> Axes:
|
|
173
|
+
from .waffle import aplot_waffle as _aplot_waffle
|
|
174
|
+
|
|
175
|
+
return _aplot_waffle(*args, **kwargs)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def fplot_waffle(*args: Any, **kwargs: Any) -> Figure:
|
|
179
|
+
from .waffle import fplot_waffle as _fplot_waffle
|
|
180
|
+
|
|
181
|
+
return _fplot_waffle(*args, **kwargs)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def fplot_treemap(*args: Any, **kwargs: Any) -> go.Figure:
|
|
185
|
+
from .treemap import fplot_treemap as _fplot_treemap
|
|
186
|
+
|
|
187
|
+
return _fplot_treemap(*args, **kwargs)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def fplot_sunburst(*args: Any, **kwargs: Any) -> go.Figure:
|
|
191
|
+
from .sunburst import fplot_sunburst as _fplot_sunburst
|
|
192
|
+
|
|
193
|
+
return _fplot_sunburst(*args, **kwargs)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def plot_composite_bubble(*args: Any, **kwargs: Any) -> Figure:
|
|
197
|
+
from .composite import plot_composite_bubble as _plot_composite_bubble
|
|
198
|
+
|
|
199
|
+
return _plot_composite_bubble(*args, **kwargs)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def plot_composite_treemap(*args: Any, **kwargs: Any) -> Optional[go.Figure]:
|
|
203
|
+
from .composite import plot_composite_treemap as _plot_composite_treemap
|
|
204
|
+
|
|
205
|
+
return _plot_composite_treemap(*args, **kwargs)
|
|
53
206
|
|
|
54
207
|
|
|
55
208
|
@register_dataframe_accessor("mpl")
|
|
56
209
|
class DataFrameAccessor:
|
|
57
210
|
"""Expose MatplotLibAPI plotting helpers as a pandas accessor.
|
|
58
211
|
|
|
212
|
+
All plot methods follow the BasePlot interface pattern, providing both
|
|
213
|
+
aplot_* (plot on existing axes) and fplot_* (plot on new figure) variants
|
|
214
|
+
for consistency and ease of use.
|
|
215
|
+
|
|
59
216
|
Methods
|
|
60
217
|
-------
|
|
61
218
|
aplot_bubble
|
|
@@ -141,7 +298,7 @@ class DataFrameAccessor:
|
|
|
141
298
|
y: str,
|
|
142
299
|
z: str,
|
|
143
300
|
title: Optional[str] = None,
|
|
144
|
-
style: StyleTemplate =
|
|
301
|
+
style: Optional[StyleTemplate] = None,
|
|
145
302
|
max_values: int = 50,
|
|
146
303
|
center_to_mean: bool = False,
|
|
147
304
|
sort_by: Optional[str] = None,
|
|
@@ -186,18 +343,21 @@ class DataFrameAccessor:
|
|
|
186
343
|
Axes
|
|
187
344
|
The Matplotlib axes object with the plot.
|
|
188
345
|
"""
|
|
189
|
-
|
|
346
|
+
bubble_style_template, Bubble = _bubble_imports()
|
|
347
|
+
|
|
348
|
+
return Bubble(
|
|
190
349
|
pd_df=self._obj,
|
|
191
350
|
label=label,
|
|
192
351
|
x=x,
|
|
193
352
|
y=y,
|
|
194
353
|
z=z,
|
|
195
|
-
title=title,
|
|
196
|
-
style=style,
|
|
197
354
|
max_values=max_values,
|
|
198
355
|
center_to_mean=center_to_mean,
|
|
199
356
|
sort_by=sort_by,
|
|
200
357
|
ascending=ascending,
|
|
358
|
+
).aplot(
|
|
359
|
+
title=title,
|
|
360
|
+
style=style or bubble_style_template,
|
|
201
361
|
hline=hline,
|
|
202
362
|
vline=vline,
|
|
203
363
|
ax=ax,
|
|
@@ -210,7 +370,7 @@ class DataFrameAccessor:
|
|
|
210
370
|
y: str,
|
|
211
371
|
z: str,
|
|
212
372
|
title: Optional[str] = None,
|
|
213
|
-
style: StyleTemplate =
|
|
373
|
+
style: Optional[StyleTemplate] = None,
|
|
214
374
|
max_values: int = 50,
|
|
215
375
|
center_to_mean: bool = False,
|
|
216
376
|
sort_by: Optional[str] = None,
|
|
@@ -218,8 +378,6 @@ class DataFrameAccessor:
|
|
|
218
378
|
hline: bool = False,
|
|
219
379
|
vline: bool = False,
|
|
220
380
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
221
|
-
save_path: Optional[str] = None,
|
|
222
|
-
savefig_kwargs: Optional[Dict[str, Any]] = None,
|
|
223
381
|
) -> Figure:
|
|
224
382
|
"""Plot a bubble chart on a new figure.
|
|
225
383
|
|
|
@@ -257,23 +415,24 @@ class DataFrameAccessor:
|
|
|
257
415
|
Figure
|
|
258
416
|
The new Matplotlib figure with the plot.
|
|
259
417
|
"""
|
|
260
|
-
|
|
418
|
+
bubble_style_template, Bubble = _bubble_imports()
|
|
419
|
+
|
|
420
|
+
return Bubble(
|
|
261
421
|
pd_df=self._obj,
|
|
262
422
|
label=label,
|
|
263
423
|
x=x,
|
|
264
424
|
y=y,
|
|
265
425
|
z=z,
|
|
266
|
-
title=title,
|
|
267
|
-
style=style,
|
|
268
|
-
max_values=max_values,
|
|
269
|
-
center_to_mean=center_to_mean,
|
|
270
426
|
sort_by=sort_by,
|
|
271
427
|
ascending=ascending,
|
|
428
|
+
max_values=max_values,
|
|
429
|
+
center_to_mean=center_to_mean,
|
|
430
|
+
).fplot(
|
|
431
|
+
title=title,
|
|
432
|
+
style=style or bubble_style_template,
|
|
272
433
|
hline=hline,
|
|
273
434
|
vline=vline,
|
|
274
435
|
figsize=figsize,
|
|
275
|
-
save_path=save_path,
|
|
276
|
-
savefig_kwargs=savefig_kwargs,
|
|
277
436
|
)
|
|
278
437
|
|
|
279
438
|
def fplot_composite_bubble(
|
|
@@ -283,7 +442,7 @@ class DataFrameAccessor:
|
|
|
283
442
|
y: str,
|
|
284
443
|
z: str,
|
|
285
444
|
title: Optional[str] = None,
|
|
286
|
-
style: StyleTemplate =
|
|
445
|
+
style: Optional[StyleTemplate] = None,
|
|
287
446
|
max_values: int = 100,
|
|
288
447
|
center_to_mean: bool = False,
|
|
289
448
|
sort_by: Optional[str] = None,
|
|
@@ -325,6 +484,8 @@ class DataFrameAccessor:
|
|
|
325
484
|
Figure
|
|
326
485
|
The new Matplotlib figure with the composite plot.
|
|
327
486
|
"""
|
|
487
|
+
bubble_style_template, _ = _bubble_imports()
|
|
488
|
+
|
|
328
489
|
return plot_composite_bubble(
|
|
329
490
|
pd_df=self._obj,
|
|
330
491
|
label=label,
|
|
@@ -332,7 +493,7 @@ class DataFrameAccessor:
|
|
|
332
493
|
y=y,
|
|
333
494
|
z=z,
|
|
334
495
|
title=title,
|
|
335
|
-
style=style,
|
|
496
|
+
style=style or bubble_style_template,
|
|
336
497
|
max_values=max_values,
|
|
337
498
|
center_to_mean=center_to_mean,
|
|
338
499
|
sort_by=sort_by,
|
|
@@ -381,7 +542,7 @@ class DataFrameAccessor:
|
|
|
381
542
|
group=group,
|
|
382
543
|
stacked=stacked,
|
|
383
544
|
title=title,
|
|
384
|
-
style=style,
|
|
545
|
+
style=style or DISTRIBUTION_STYLE_TEMPLATE,
|
|
385
546
|
ax=ax,
|
|
386
547
|
)
|
|
387
548
|
|
|
@@ -461,7 +622,7 @@ class DataFrameAccessor:
|
|
|
461
622
|
Axes
|
|
462
623
|
The Matplotlib axes object with the histogram.
|
|
463
624
|
"""
|
|
464
|
-
return
|
|
625
|
+
return aplot_histogram(
|
|
465
626
|
pd_df=self._obj,
|
|
466
627
|
column=column,
|
|
467
628
|
bins=bins,
|
|
@@ -502,7 +663,7 @@ class DataFrameAccessor:
|
|
|
502
663
|
Figure
|
|
503
664
|
The new Matplotlib figure with the histogram.
|
|
504
665
|
"""
|
|
505
|
-
return
|
|
666
|
+
return fplot_histogram(
|
|
506
667
|
pd_df=self._obj,
|
|
507
668
|
column=column,
|
|
508
669
|
bins=bins,
|
|
@@ -600,7 +761,7 @@ class DataFrameAccessor:
|
|
|
600
761
|
y: str,
|
|
601
762
|
value: str,
|
|
602
763
|
title: Optional[str] = None,
|
|
603
|
-
style: StyleTemplate =
|
|
764
|
+
style: Optional[StyleTemplate] = None,
|
|
604
765
|
ax: Optional[Axes] = None,
|
|
605
766
|
) -> Axes:
|
|
606
767
|
"""Plot a heatmap for dense categorical combinations.
|
|
@@ -625,13 +786,15 @@ class DataFrameAccessor:
|
|
|
625
786
|
Axes
|
|
626
787
|
The Matplotlib axes object with the heatmap.
|
|
627
788
|
"""
|
|
789
|
+
heatmap_style_template, _, aplot_heatmap, _, _ = _heatmap_imports()
|
|
790
|
+
|
|
628
791
|
return aplot_heatmap(
|
|
629
792
|
pd_df=self._obj,
|
|
630
793
|
x=x,
|
|
631
794
|
y=y,
|
|
632
795
|
value=value,
|
|
633
796
|
title=title,
|
|
634
|
-
style=style,
|
|
797
|
+
style=style or DISTRIBUTION_STYLE_TEMPLATE,
|
|
635
798
|
ax=ax,
|
|
636
799
|
)
|
|
637
800
|
|
|
@@ -641,7 +804,7 @@ class DataFrameAccessor:
|
|
|
641
804
|
y: str,
|
|
642
805
|
value: str,
|
|
643
806
|
title: Optional[str] = None,
|
|
644
|
-
style: StyleTemplate =
|
|
807
|
+
style: Optional[StyleTemplate] = None,
|
|
645
808
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
646
809
|
) -> Figure:
|
|
647
810
|
"""Plot a heatmap on a new figure.
|
|
@@ -666,13 +829,15 @@ class DataFrameAccessor:
|
|
|
666
829
|
Figure
|
|
667
830
|
The new Matplotlib figure with the heatmap.
|
|
668
831
|
"""
|
|
832
|
+
heatmap_style_template, _, _, _, fplot_heatmap = _heatmap_imports()
|
|
833
|
+
|
|
669
834
|
return fplot_heatmap(
|
|
670
835
|
pd_df=self._obj,
|
|
671
836
|
x=x,
|
|
672
837
|
y=y,
|
|
673
838
|
value=value,
|
|
674
839
|
title=title,
|
|
675
|
-
style=style,
|
|
840
|
+
style=style or heatmap_style_template,
|
|
676
841
|
figsize=figsize,
|
|
677
842
|
)
|
|
678
843
|
|
|
@@ -681,7 +846,7 @@ class DataFrameAccessor:
|
|
|
681
846
|
columns: Optional[List[str]] = None,
|
|
682
847
|
method: CorrelationMethod = "pearson",
|
|
683
848
|
title: Optional[str] = None,
|
|
684
|
-
style: StyleTemplate =
|
|
849
|
+
style: Optional[StyleTemplate] = None,
|
|
685
850
|
ax: Optional[Axes] = None,
|
|
686
851
|
) -> Axes:
|
|
687
852
|
"""Plot a correlation matrix heatmap.
|
|
@@ -704,52 +869,17 @@ class DataFrameAccessor:
|
|
|
704
869
|
Axes
|
|
705
870
|
The Matplotlib axes object with the correlation matrix.
|
|
706
871
|
"""
|
|
872
|
+
heatmap_style_template, aplot_correlation_matrix, _, _, _ = _heatmap_imports()
|
|
873
|
+
|
|
707
874
|
return aplot_correlation_matrix(
|
|
708
875
|
pd_df=self._obj,
|
|
709
876
|
columns=columns,
|
|
710
877
|
method=method,
|
|
711
878
|
title=title,
|
|
712
|
-
style=style,
|
|
879
|
+
style=style or DISTRIBUTION_STYLE_TEMPLATE,
|
|
713
880
|
ax=ax,
|
|
714
881
|
)
|
|
715
882
|
|
|
716
|
-
def fplot_correlation_matrix(
|
|
717
|
-
self,
|
|
718
|
-
columns: Optional[List[str]] = None,
|
|
719
|
-
method: CorrelationMethod = "pearson",
|
|
720
|
-
title: Optional[str] = None,
|
|
721
|
-
style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
|
|
722
|
-
figsize: Tuple[float, float] = FIG_SIZE,
|
|
723
|
-
) -> Figure:
|
|
724
|
-
"""Plot a correlation matrix heatmap on a new figure.
|
|
725
|
-
|
|
726
|
-
Parameters
|
|
727
|
-
----------
|
|
728
|
-
columns : list[str], optional
|
|
729
|
-
Numeric columns to include. The default is ``None`` for all numeric columns.
|
|
730
|
-
method : CorrelationMethod, optional
|
|
731
|
-
Correlation method. The default is "pearson".
|
|
732
|
-
title : str, optional
|
|
733
|
-
Chart title.
|
|
734
|
-
style : StyleTemplate, optional
|
|
735
|
-
Styling template. The default is ``HEATMAP_STYLE_TEMPLATE``.
|
|
736
|
-
figsize : tuple[float, float], optional
|
|
737
|
-
Figure size. The default is FIG_SIZE.
|
|
738
|
-
|
|
739
|
-
Returns
|
|
740
|
-
-------
|
|
741
|
-
Figure
|
|
742
|
-
The new Matplotlib figure with the correlation matrix.
|
|
743
|
-
"""
|
|
744
|
-
return fplot_correlation_matrix(
|
|
745
|
-
pd_df=self._obj,
|
|
746
|
-
columns=columns,
|
|
747
|
-
method=method,
|
|
748
|
-
title=title,
|
|
749
|
-
style=style,
|
|
750
|
-
figsize=figsize,
|
|
751
|
-
)
|
|
752
|
-
|
|
753
883
|
def aplot_area(
|
|
754
884
|
self,
|
|
755
885
|
x: str,
|
|
@@ -759,6 +889,7 @@ class DataFrameAccessor:
|
|
|
759
889
|
title: Optional[str] = None,
|
|
760
890
|
style: StyleTemplate = AREA_STYLE_TEMPLATE,
|
|
761
891
|
ax: Optional[Axes] = None,
|
|
892
|
+
**kwargs: Any,
|
|
762
893
|
) -> Axes:
|
|
763
894
|
"""Plot an area chart on existing axes.
|
|
764
895
|
|
|
@@ -778,6 +909,8 @@ class DataFrameAccessor:
|
|
|
778
909
|
Styling template. The default is ``AREA_STYLE_TEMPLATE``.
|
|
779
910
|
ax : Axes, optional
|
|
780
911
|
Matplotlib axes to plot on. If None, uses the current axes.
|
|
912
|
+
**kwargs : Any
|
|
913
|
+
Additional keyword arguments forwarded to the underlying area plot call.
|
|
781
914
|
|
|
782
915
|
Returns
|
|
783
916
|
-------
|
|
@@ -785,14 +918,15 @@ class DataFrameAccessor:
|
|
|
785
918
|
The Matplotlib axes object with the area chart.
|
|
786
919
|
"""
|
|
787
920
|
return aplot_area(
|
|
788
|
-
|
|
789
|
-
x
|
|
790
|
-
y
|
|
921
|
+
self._obj,
|
|
922
|
+
x,
|
|
923
|
+
y,
|
|
791
924
|
label=label,
|
|
792
925
|
stacked=stacked,
|
|
793
926
|
title=title,
|
|
794
927
|
style=style,
|
|
795
928
|
ax=ax,
|
|
929
|
+
**kwargs,
|
|
796
930
|
)
|
|
797
931
|
|
|
798
932
|
def fplot_area(
|
|
@@ -804,6 +938,7 @@ class DataFrameAccessor:
|
|
|
804
938
|
title: Optional[str] = None,
|
|
805
939
|
style: StyleTemplate = AREA_STYLE_TEMPLATE,
|
|
806
940
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
941
|
+
**kwargs: Any,
|
|
807
942
|
) -> Figure:
|
|
808
943
|
"""Plot an area chart on a new figure.
|
|
809
944
|
|
|
@@ -823,6 +958,8 @@ class DataFrameAccessor:
|
|
|
823
958
|
Styling template. The default is ``AREA_STYLE_TEMPLATE``.
|
|
824
959
|
figsize : tuple[float, float], optional
|
|
825
960
|
Figure size. The default is FIG_SIZE.
|
|
961
|
+
**kwargs : Any
|
|
962
|
+
Additional keyword arguments forwarded to the underlying area plot call.
|
|
826
963
|
|
|
827
964
|
Returns
|
|
828
965
|
-------
|
|
@@ -830,14 +967,15 @@ class DataFrameAccessor:
|
|
|
830
967
|
The new Matplotlib figure with the area chart.
|
|
831
968
|
"""
|
|
832
969
|
return fplot_area(
|
|
833
|
-
|
|
834
|
-
x
|
|
835
|
-
y
|
|
970
|
+
self._obj,
|
|
971
|
+
x,
|
|
972
|
+
y,
|
|
836
973
|
label=label,
|
|
837
974
|
stacked=stacked,
|
|
838
975
|
title=title,
|
|
839
976
|
style=style,
|
|
840
977
|
figsize=figsize,
|
|
978
|
+
**kwargs,
|
|
841
979
|
)
|
|
842
980
|
|
|
843
981
|
def aplot_pie_donut(
|
|
@@ -1010,7 +1148,7 @@ class DataFrameAccessor:
|
|
|
1010
1148
|
target: str,
|
|
1011
1149
|
value: str,
|
|
1012
1150
|
title: Optional[str] = None,
|
|
1013
|
-
style: StyleTemplate =
|
|
1151
|
+
style: Optional[StyleTemplate] = None,
|
|
1014
1152
|
) -> go.Figure:
|
|
1015
1153
|
"""Plot a Sankey diagram for flow data.
|
|
1016
1154
|
|
|
@@ -1032,13 +1170,15 @@ class DataFrameAccessor:
|
|
|
1032
1170
|
go.Figure
|
|
1033
1171
|
The Plotly Sankey figure.
|
|
1034
1172
|
"""
|
|
1173
|
+
sankey_style_template, fplot_sankey = _sankey_imports()
|
|
1174
|
+
|
|
1035
1175
|
return fplot_sankey(
|
|
1036
1176
|
pd_df=self._obj,
|
|
1037
1177
|
source=source,
|
|
1038
1178
|
target=target,
|
|
1039
1179
|
value=value,
|
|
1040
1180
|
title=title,
|
|
1041
|
-
style=style,
|
|
1181
|
+
style=style or sankey_style_template,
|
|
1042
1182
|
)
|
|
1043
1183
|
|
|
1044
1184
|
def aplot_table(
|
|
@@ -1079,7 +1219,7 @@ class DataFrameAccessor:
|
|
|
1079
1219
|
pd_df=self._obj,
|
|
1080
1220
|
cols=cols,
|
|
1081
1221
|
title=title,
|
|
1082
|
-
style=style,
|
|
1222
|
+
style=style or TABLE_STYLE_TEMPLATE,
|
|
1083
1223
|
max_values=max_values,
|
|
1084
1224
|
sort_by=sort_by,
|
|
1085
1225
|
ascending=ascending,
|
|
@@ -1124,7 +1264,7 @@ class DataFrameAccessor:
|
|
|
1124
1264
|
pd_df=self._obj,
|
|
1125
1265
|
cols=cols,
|
|
1126
1266
|
title=title,
|
|
1127
|
-
style=style,
|
|
1267
|
+
style=style or TABLE_STYLE_TEMPLATE,
|
|
1128
1268
|
max_values=max_values,
|
|
1129
1269
|
sort_by=sort_by,
|
|
1130
1270
|
ascending=ascending,
|
|
@@ -1180,7 +1320,7 @@ class DataFrameAccessor:
|
|
|
1180
1320
|
x=x,
|
|
1181
1321
|
y=y,
|
|
1182
1322
|
title=title,
|
|
1183
|
-
style=style,
|
|
1323
|
+
style=style or TIMESERIE_STYLE_TEMPLATE,
|
|
1184
1324
|
max_values=max_values,
|
|
1185
1325
|
sort_by=sort_by,
|
|
1186
1326
|
ascending=ascending,
|
|
@@ -1237,7 +1377,7 @@ class DataFrameAccessor:
|
|
|
1237
1377
|
x=x,
|
|
1238
1378
|
y=y,
|
|
1239
1379
|
title=title,
|
|
1240
|
-
style=style,
|
|
1380
|
+
style=style or TIMESERIE_STYLE_TEMPLATE,
|
|
1241
1381
|
max_values=max_values,
|
|
1242
1382
|
sort_by=sort_by,
|
|
1243
1383
|
ascending=ascending,
|
|
@@ -1248,9 +1388,9 @@ class DataFrameAccessor:
|
|
|
1248
1388
|
def aplot_wordcloud(
|
|
1249
1389
|
self,
|
|
1250
1390
|
text_column: str,
|
|
1251
|
-
weight_column:
|
|
1391
|
+
weight_column: str,
|
|
1252
1392
|
title: Optional[str] = None,
|
|
1253
|
-
style: StyleTemplate =
|
|
1393
|
+
style: Optional[StyleTemplate] = None,
|
|
1254
1394
|
max_words: int = 50,
|
|
1255
1395
|
stopwords: Optional[List[str]] = None,
|
|
1256
1396
|
random_state: Optional[int] = None,
|
|
@@ -1282,12 +1422,14 @@ class DataFrameAccessor:
|
|
|
1282
1422
|
Axes
|
|
1283
1423
|
The Matplotlib axes object with the plot.
|
|
1284
1424
|
"""
|
|
1425
|
+
wordcloud_style_template, aplot_wordcloud, _ = _wordcloud_imports()
|
|
1426
|
+
|
|
1285
1427
|
return aplot_wordcloud(
|
|
1286
1428
|
pd_df=self._obj,
|
|
1287
1429
|
text_column=text_column,
|
|
1288
1430
|
weight_column=weight_column,
|
|
1289
1431
|
title=title,
|
|
1290
|
-
style=style,
|
|
1432
|
+
style=style or wordcloud_style_template,
|
|
1291
1433
|
max_words=max_words,
|
|
1292
1434
|
stopwords=stopwords,
|
|
1293
1435
|
random_state=random_state,
|
|
@@ -1297,9 +1439,9 @@ class DataFrameAccessor:
|
|
|
1297
1439
|
def fplot_wordcloud(
|
|
1298
1440
|
self,
|
|
1299
1441
|
text_column: str,
|
|
1300
|
-
weight_column:
|
|
1442
|
+
weight_column: str,
|
|
1301
1443
|
title: Optional[str] = None,
|
|
1302
|
-
style: StyleTemplate =
|
|
1444
|
+
style: Optional[StyleTemplate] = None,
|
|
1303
1445
|
max_words: int = 50,
|
|
1304
1446
|
stopwords: Optional[List[str]] = None,
|
|
1305
1447
|
random_state: Optional[int] = None,
|
|
@@ -1331,12 +1473,14 @@ class DataFrameAccessor:
|
|
|
1331
1473
|
Figure
|
|
1332
1474
|
The new Matplotlib figure with the plot.
|
|
1333
1475
|
"""
|
|
1476
|
+
wordcloud_style_template, _, fplot_wordcloud = _wordcloud_imports()
|
|
1477
|
+
|
|
1334
1478
|
return fplot_wordcloud(
|
|
1335
1479
|
pd_df=self._obj,
|
|
1336
1480
|
text_column=text_column,
|
|
1337
1481
|
weight_column=weight_column,
|
|
1338
1482
|
title=title,
|
|
1339
|
-
style=style,
|
|
1483
|
+
style=style or wordcloud_style_template,
|
|
1340
1484
|
max_words=max_words,
|
|
1341
1485
|
stopwords=stopwords,
|
|
1342
1486
|
random_state=random_state,
|
|
@@ -1345,16 +1489,11 @@ class DataFrameAccessor:
|
|
|
1345
1489
|
|
|
1346
1490
|
def aplot_network(
|
|
1347
1491
|
self,
|
|
1348
|
-
node_col: str = "node",
|
|
1349
|
-
node_weight_col: str = "weight",
|
|
1350
1492
|
edge_source_col: str = "source",
|
|
1351
1493
|
edge_target_col: str = "target",
|
|
1352
1494
|
edge_weight_col: str = "weight",
|
|
1353
|
-
sort_by: Optional[str] = None,
|
|
1354
|
-
ascending: bool = False,
|
|
1355
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1356
1495
|
title: Optional[str] = None,
|
|
1357
|
-
style: StyleTemplate =
|
|
1496
|
+
style: Optional[StyleTemplate] = None,
|
|
1358
1497
|
layout_seed: Optional[int] = None,
|
|
1359
1498
|
ax: Optional[Axes] = None,
|
|
1360
1499
|
) -> Axes:
|
|
@@ -1396,18 +1535,15 @@ class DataFrameAccessor:
|
|
|
1396
1535
|
if layout_seed is not None:
|
|
1397
1536
|
kwargs["layout_seed"] = layout_seed
|
|
1398
1537
|
|
|
1538
|
+
network_style_template, aplot_network, _, _, _, _, _ = _network_imports()
|
|
1539
|
+
|
|
1399
1540
|
return aplot_network(
|
|
1400
1541
|
pd_df=self._obj,
|
|
1401
|
-
node_col=node_col,
|
|
1402
|
-
node_weight_col=node_weight_col,
|
|
1403
1542
|
edge_source_col=edge_source_col,
|
|
1404
1543
|
edge_target_col=edge_target_col,
|
|
1405
1544
|
edge_weight_col=edge_weight_col,
|
|
1406
|
-
sort_by=sort_by,
|
|
1407
|
-
ascending=ascending,
|
|
1408
|
-
node_df=node_df,
|
|
1409
1545
|
title=title,
|
|
1410
|
-
style=style,
|
|
1546
|
+
style=style or network_style_template,
|
|
1411
1547
|
ax=ax,
|
|
1412
1548
|
**kwargs,
|
|
1413
1549
|
)
|
|
@@ -1415,17 +1551,12 @@ class DataFrameAccessor:
|
|
|
1415
1551
|
def aplot_network_node(
|
|
1416
1552
|
self,
|
|
1417
1553
|
node: Any,
|
|
1418
|
-
node_col: str = "node",
|
|
1419
|
-
node_weight_col: str = "weight",
|
|
1420
1554
|
edge_source_col: str = "source",
|
|
1421
1555
|
edge_target_col: str = "target",
|
|
1422
1556
|
edge_weight_col: str = "weight",
|
|
1423
|
-
sort_by: Optional[str] = None,
|
|
1424
|
-
ascending: bool = False,
|
|
1425
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1426
1557
|
layout_seed: Optional[int] = None,
|
|
1427
1558
|
title: Optional[str] = None,
|
|
1428
|
-
style: StyleTemplate =
|
|
1559
|
+
style: Optional[StyleTemplate] = None,
|
|
1429
1560
|
ax: Optional[Axes] = None,
|
|
1430
1561
|
) -> Axes:
|
|
1431
1562
|
"""Plot the connected component containing ``node``.
|
|
@@ -1473,35 +1604,29 @@ class DataFrameAccessor:
|
|
|
1473
1604
|
if layout_seed is not None:
|
|
1474
1605
|
kwargs["layout_seed"] = layout_seed
|
|
1475
1606
|
|
|
1607
|
+
network_style_template, _, aplot_network_node, _, _, _, _ = _network_imports()
|
|
1608
|
+
|
|
1476
1609
|
return aplot_network_node(
|
|
1477
1610
|
pd_df=self._obj,
|
|
1478
1611
|
node=node,
|
|
1479
|
-
node_col=node_col,
|
|
1480
|
-
node_weight_col=node_weight_col,
|
|
1481
1612
|
edge_source_col=edge_source_col,
|
|
1482
1613
|
edge_target_col=edge_target_col,
|
|
1483
1614
|
edge_weight_col=edge_weight_col,
|
|
1484
|
-
sort_by=sort_by,
|
|
1485
|
-
ascending=ascending,
|
|
1486
|
-
node_df=node_df,
|
|
1487
1615
|
title=title,
|
|
1488
|
-
style=style,
|
|
1616
|
+
style=style or network_style_template,
|
|
1489
1617
|
ax=ax,
|
|
1490
1618
|
**kwargs,
|
|
1491
1619
|
)
|
|
1492
1620
|
|
|
1493
1621
|
def aplot_network_components(
|
|
1494
1622
|
self,
|
|
1495
|
-
node_col: str = "node",
|
|
1496
|
-
node_weight_col: str = "weight",
|
|
1497
1623
|
edge_source_col: str = "source",
|
|
1498
1624
|
edge_target_col: str = "target",
|
|
1499
1625
|
edge_weight_col: str = "weight",
|
|
1500
1626
|
sort_by: Optional[str] = None,
|
|
1501
1627
|
ascending: bool = False,
|
|
1502
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1503
1628
|
title: Optional[str] = None,
|
|
1504
|
-
style: StyleTemplate =
|
|
1629
|
+
style: Optional[StyleTemplate] = None,
|
|
1505
1630
|
layout_seed: Optional[int] = None,
|
|
1506
1631
|
axes: Optional[np.ndarray] = None,
|
|
1507
1632
|
) -> None:
|
|
@@ -1538,34 +1663,30 @@ class DataFrameAccessor:
|
|
|
1538
1663
|
if layout_seed is not None:
|
|
1539
1664
|
kwargs["layout_seed"] = layout_seed
|
|
1540
1665
|
|
|
1666
|
+
network_style_template, _, _, aplot_network_components, _, _, _ = (
|
|
1667
|
+
_network_imports()
|
|
1668
|
+
)
|
|
1669
|
+
|
|
1541
1670
|
aplot_network_components(
|
|
1542
1671
|
pd_df=self._obj,
|
|
1543
|
-
node_col=node_col,
|
|
1544
|
-
node_weight_col=node_weight_col,
|
|
1545
1672
|
edge_source_col=edge_source_col,
|
|
1546
1673
|
edge_target_col=edge_target_col,
|
|
1547
1674
|
edge_weight_col=edge_weight_col,
|
|
1548
1675
|
sort_by=sort_by,
|
|
1549
1676
|
ascending=ascending,
|
|
1550
|
-
node_df=node_df,
|
|
1551
1677
|
title=title,
|
|
1552
|
-
style=style,
|
|
1678
|
+
style=style or network_style_template,
|
|
1553
1679
|
axes=axes,
|
|
1554
1680
|
**kwargs,
|
|
1555
1681
|
)
|
|
1556
1682
|
|
|
1557
1683
|
def fplot_network(
|
|
1558
1684
|
self,
|
|
1559
|
-
node_col: str = "node",
|
|
1560
|
-
node_weight_col: str = "weight",
|
|
1561
1685
|
edge_source_col: str = "source",
|
|
1562
1686
|
edge_target_col: str = "target",
|
|
1563
1687
|
edge_weight_col: str = "weight",
|
|
1564
|
-
sort_by: Optional[str] = None,
|
|
1565
|
-
ascending: bool = False,
|
|
1566
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1567
1688
|
title: Optional[str] = None,
|
|
1568
|
-
style: StyleTemplate =
|
|
1689
|
+
style: Optional[StyleTemplate] = None,
|
|
1569
1690
|
layout_seed: Optional[int] = None,
|
|
1570
1691
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
1571
1692
|
) -> Figure:
|
|
@@ -1607,18 +1728,15 @@ class DataFrameAccessor:
|
|
|
1607
1728
|
if layout_seed is not None:
|
|
1608
1729
|
kwargs["layout_seed"] = layout_seed
|
|
1609
1730
|
|
|
1731
|
+
network_style_template, _, _, _, fplot_network, _, _ = _network_imports()
|
|
1732
|
+
|
|
1610
1733
|
return fplot_network(
|
|
1611
1734
|
pd_df=self._obj,
|
|
1612
|
-
node_col=node_col,
|
|
1613
|
-
node_weight_col=node_weight_col,
|
|
1614
1735
|
edge_source_col=edge_source_col,
|
|
1615
1736
|
edge_target_col=edge_target_col,
|
|
1616
1737
|
edge_weight_col=edge_weight_col,
|
|
1617
|
-
sort_by=sort_by,
|
|
1618
|
-
ascending=ascending,
|
|
1619
|
-
node_df=node_df,
|
|
1620
1738
|
title=title,
|
|
1621
|
-
style=style,
|
|
1739
|
+
style=style or network_style_template,
|
|
1622
1740
|
figsize=figsize,
|
|
1623
1741
|
**kwargs,
|
|
1624
1742
|
)
|
|
@@ -1626,17 +1744,12 @@ class DataFrameAccessor:
|
|
|
1626
1744
|
def fplot_network_node(
|
|
1627
1745
|
self,
|
|
1628
1746
|
node: Any,
|
|
1629
|
-
node_col: str = "node",
|
|
1630
|
-
node_weight_col: str = "weight",
|
|
1631
1747
|
edge_source_col: str = "source",
|
|
1632
1748
|
edge_target_col: str = "target",
|
|
1633
1749
|
edge_weight_col: str = "weight",
|
|
1634
|
-
sort_by: Optional[str] = None,
|
|
1635
|
-
ascending: bool = False,
|
|
1636
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1637
1750
|
layout_seed: Optional[int] = None,
|
|
1638
1751
|
title: Optional[str] = None,
|
|
1639
|
-
style: StyleTemplate =
|
|
1752
|
+
style: Optional[StyleTemplate] = None,
|
|
1640
1753
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
1641
1754
|
) -> Figure:
|
|
1642
1755
|
"""Plot the connected component containing ``node`` on a new figure.
|
|
@@ -1684,35 +1797,27 @@ class DataFrameAccessor:
|
|
|
1684
1797
|
if layout_seed is not None:
|
|
1685
1798
|
kwargs["layout_seed"] = layout_seed
|
|
1686
1799
|
|
|
1800
|
+
network_style_template, _, _, _, _, fplot_network_node, _ = _network_imports()
|
|
1801
|
+
|
|
1687
1802
|
return fplot_network_node(
|
|
1688
1803
|
pd_df=self._obj,
|
|
1689
1804
|
node=node,
|
|
1690
|
-
node_col=node_col,
|
|
1691
|
-
node_weight_col=node_weight_col,
|
|
1692
1805
|
edge_source_col=edge_source_col,
|
|
1693
1806
|
edge_target_col=edge_target_col,
|
|
1694
1807
|
edge_weight_col=edge_weight_col,
|
|
1695
|
-
sort_by=sort_by,
|
|
1696
|
-
ascending=ascending,
|
|
1697
|
-
node_df=node_df,
|
|
1698
1808
|
title=title,
|
|
1699
|
-
style=style,
|
|
1809
|
+
style=style or network_style_template,
|
|
1700
1810
|
figsize=figsize,
|
|
1701
1811
|
**kwargs,
|
|
1702
1812
|
)
|
|
1703
1813
|
|
|
1704
1814
|
def fplot_network_components(
|
|
1705
1815
|
self,
|
|
1706
|
-
node_col: str = "node",
|
|
1707
|
-
node_weight_col: str = "weight",
|
|
1708
1816
|
edge_source_col: str = "source",
|
|
1709
1817
|
edge_target_col: str = "target",
|
|
1710
1818
|
edge_weight_col: str = "weight",
|
|
1711
|
-
sort_by: Optional[str] = None,
|
|
1712
|
-
ascending: bool = False,
|
|
1713
|
-
node_df: Optional[pd.DataFrame] = None,
|
|
1714
1819
|
title: Optional[str] = None,
|
|
1715
|
-
style: StyleTemplate =
|
|
1820
|
+
style: Optional[StyleTemplate] = None,
|
|
1716
1821
|
layout_seed: Optional[int] = None,
|
|
1717
1822
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
1718
1823
|
n_cols: Optional[int] = None,
|
|
@@ -1757,18 +1862,17 @@ class DataFrameAccessor:
|
|
|
1757
1862
|
if layout_seed is not None:
|
|
1758
1863
|
kwargs["layout_seed"] = layout_seed
|
|
1759
1864
|
|
|
1865
|
+
network_style_template, _, _, _, _, _, fplot_network_components = (
|
|
1866
|
+
_network_imports()
|
|
1867
|
+
)
|
|
1868
|
+
|
|
1760
1869
|
return fplot_network_components(
|
|
1761
1870
|
pd_df=self._obj,
|
|
1762
|
-
node_col=node_col,
|
|
1763
|
-
node_weight_col=node_weight_col,
|
|
1764
1871
|
edge_source_col=edge_source_col,
|
|
1765
1872
|
edge_target_col=edge_target_col,
|
|
1766
1873
|
edge_weight_col=edge_weight_col,
|
|
1767
|
-
sort_by=sort_by,
|
|
1768
|
-
ascending=ascending,
|
|
1769
|
-
node_df=node_df,
|
|
1770
1874
|
title=title,
|
|
1771
|
-
style=style,
|
|
1875
|
+
style=style or network_style_template,
|
|
1772
1876
|
figsize=figsize,
|
|
1773
1877
|
n_cols=n_cols,
|
|
1774
1878
|
**kwargs,
|
|
@@ -1824,7 +1928,7 @@ class DataFrameAccessor:
|
|
|
1824
1928
|
sort_by=sort_by,
|
|
1825
1929
|
max_values=max_values,
|
|
1826
1930
|
ascending=ascending,
|
|
1827
|
-
fig=fig,
|
|
1931
|
+
fig=fig, # type: ignore
|
|
1828
1932
|
)
|
|
1829
1933
|
|
|
1830
1934
|
def fplot_sunburst(
|
|
@@ -1834,10 +1938,6 @@ class DataFrameAccessor:
|
|
|
1834
1938
|
values: str,
|
|
1835
1939
|
style: StyleTemplate = TREEMAP_STYLE_TEMPLATE,
|
|
1836
1940
|
title: Optional[str] = None,
|
|
1837
|
-
sort_by: Optional[str] = None,
|
|
1838
|
-
max_values: int = 100,
|
|
1839
|
-
ascending: bool = False,
|
|
1840
|
-
fig: Optional[go.Figure] = None,
|
|
1841
1941
|
) -> go.Figure:
|
|
1842
1942
|
"""Plot a sunburst chart on a new Plotly figure.
|
|
1843
1943
|
|
|
@@ -1861,6 +1961,7 @@ class DataFrameAccessor:
|
|
|
1861
1961
|
Sort order. The default is `False`.
|
|
1862
1962
|
fig : go.Figure, optional
|
|
1863
1963
|
Existing Plotly figure to add to. If None, a new figure is created.
|
|
1964
|
+
|
|
1864
1965
|
Returns
|
|
1865
1966
|
-------
|
|
1866
1967
|
go.Figure
|
|
@@ -1873,10 +1974,6 @@ class DataFrameAccessor:
|
|
|
1873
1974
|
values=values,
|
|
1874
1975
|
title=title,
|
|
1875
1976
|
style=style,
|
|
1876
|
-
sort_by=sort_by,
|
|
1877
|
-
ascending=ascending,
|
|
1878
|
-
max_values=max_values,
|
|
1879
|
-
fig=fig,
|
|
1880
1977
|
)
|
|
1881
1978
|
|
|
1882
1979
|
def fplot_composite_treemap(
|