MatplotLibAPI 3.2.16__py3-none-any.whl → 3.2.18__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/Area.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Area chart helpers."""
2
2
 
3
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Dict, Optional, Tuple
4
4
 
5
5
  import pandas as pd
6
6
  from matplotlib.axes import Axes
@@ -61,6 +61,8 @@ def fplot_area(
61
61
  title: Optional[str] = None,
62
62
  style: StyleTemplate = AREA_STYLE_TEMPLATE,
63
63
  figsize: Tuple[float, float] = (10, 6),
64
+ save_path: Optional[str] = None,
65
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
64
66
  ) -> Figure:
65
67
  """Plot area charts on a new figure."""
66
68
  return _wrap_aplot(
@@ -73,4 +75,6 @@ def fplot_area(
73
75
  stacked=stacked,
74
76
  title=title,
75
77
  style=style,
78
+ save_path=save_path,
79
+ savefig_kwargs=savefig_kwargs,
76
80
  )
MatplotLibAPI/Bar.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Bar and stacked bar chart helpers."""
2
2
 
3
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Dict, Optional, Tuple
4
4
 
5
5
  import pandas as pd
6
6
  import seaborn as sns
@@ -64,6 +64,8 @@ def fplot_bar(
64
64
  title: Optional[str] = None,
65
65
  style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
66
66
  figsize: Tuple[float, float] = (10, 6),
67
+ save_path: Optional[str] = None,
68
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
67
69
  ) -> Figure:
68
70
  """Plot bar or stacked bar charts on a new figure."""
69
71
  return _wrap_aplot(
@@ -76,4 +78,6 @@ def fplot_bar(
76
78
  stacked=stacked,
77
79
  title=title,
78
80
  style=style,
81
+ save_path=save_path,
82
+ savefig_kwargs=savefig_kwargs,
79
83
  )
@@ -1,6 +1,6 @@
1
1
  """Box and violin plot helpers."""
2
2
 
3
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Dict, Optional, Tuple
4
4
 
5
5
  import pandas as pd
6
6
  import seaborn as sns
@@ -55,6 +55,8 @@ def fplot_box_violin(
55
55
  title: Optional[str] = None,
56
56
  style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
57
57
  figsize: Tuple[float, float] = (10, 6),
58
+ save_path: Optional[str] = None,
59
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
58
60
  ) -> Figure:
59
61
  """Plot box or violin charts on a new figure."""
60
62
  return _wrap_aplot(
@@ -66,4 +68,6 @@ def fplot_box_violin(
66
68
  violin=violin,
67
69
  title=title,
68
70
  style=style,
71
+ save_path=save_path,
72
+ savefig_kwargs=savefig_kwargs,
69
73
  )
MatplotLibAPI/Bubble.py CHANGED
@@ -4,7 +4,7 @@ Provides functions to create and render bubble charts using seaborn and matplotl
4
4
  with customizable styling via `StyleTemplate`.
5
5
  """
6
6
 
7
- from typing import Dict, Optional, Tuple, cast
7
+ from typing import Any, Dict, Optional, Tuple, cast
8
8
 
9
9
  import matplotlib.pyplot as plt
10
10
  import pandas as pd
@@ -374,6 +374,8 @@ def fplot_bubble(
374
374
  hline: bool = False,
375
375
  vline: bool = False,
376
376
  figsize: Tuple[float, float] = (19.2, 10.8),
377
+ save_path: Optional[str] = None,
378
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
377
379
  ) -> Figure:
378
380
  """Create a new matplotlib Figure with a bubble chart.
379
381
 
@@ -450,4 +452,6 @@ def fplot_bubble(
450
452
  vline=vline,
451
453
  ax=ax,
452
454
  )
455
+ if save_path:
456
+ fig.savefig(save_path, **(savefig_kwargs or {}))
453
457
  return fig
MatplotLibAPI/Heatmap.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Heatmap and correlation matrix helpers."""
2
2
 
3
- from typing import Any, Optional, Sequence, Tuple
3
+ from typing import Any, Dict, Optional, Sequence, Tuple
4
4
 
5
5
  import numpy as np
6
6
  import pandas as pd
@@ -79,6 +79,8 @@ def fplot_heatmap(
79
79
  title: Optional[str] = None,
80
80
  style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
81
81
  figsize: Tuple[float, float] = (10, 6),
82
+ save_path: Optional[str] = None,
83
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
82
84
  ) -> Figure:
83
85
  """Plot a matrix heatmap on a new figure."""
84
86
  return _wrap_aplot(
@@ -90,6 +92,8 @@ def fplot_heatmap(
90
92
  value=value,
91
93
  title=title,
92
94
  style=style,
95
+ save_path=save_path,
96
+ savefig_kwargs=savefig_kwargs,
93
97
  )
94
98
 
95
99
 
@@ -100,6 +104,8 @@ def fplot_correlation_matrix(
100
104
  title: Optional[str] = None,
101
105
  style: StyleTemplate = HEATMAP_STYLE_TEMPLATE,
102
106
  figsize: Tuple[float, float] = (10, 6),
107
+ save_path: Optional[str] = None,
108
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
103
109
  ) -> Figure:
104
110
  """Plot a correlation matrix heatmap on a new figure."""
105
111
  return _wrap_aplot(
@@ -110,4 +116,6 @@ def fplot_correlation_matrix(
110
116
  method=method,
111
117
  title=title,
112
118
  style=style,
119
+ save_path=save_path,
120
+ savefig_kwargs=savefig_kwargs,
113
121
  )
@@ -1,6 +1,6 @@
1
1
  """Histogram and KDE plotting helpers."""
2
2
 
3
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Dict, Optional, Tuple
4
4
 
5
5
  import pandas as pd
6
6
  import seaborn as sns
@@ -55,6 +55,8 @@ def fplot_histogram_kde(
55
55
  title: Optional[str] = None,
56
56
  style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
57
57
  figsize: Tuple[float, float] = (10, 6),
58
+ save_path: Optional[str] = None,
59
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
58
60
  ) -> Figure:
59
61
  """Plot a histogram with optional KDE on a new figure."""
60
62
  return _wrap_aplot(
@@ -66,4 +68,6 @@ def fplot_histogram_kde(
66
68
  kde=kde,
67
69
  title=title,
68
70
  style=style,
71
+ save_path=save_path,
72
+ savefig_kwargs=savefig_kwargs,
69
73
  )
MatplotLibAPI/Network.py CHANGED
@@ -807,6 +807,8 @@ def fplot_network(
807
807
  ascending: bool = False,
808
808
  node_list: Optional[List] = None,
809
809
  figsize: Tuple[float, float] = (19.2, 10.8),
810
+ save_path: Optional[str] = None,
811
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
810
812
  ) -> Figure:
811
813
  """Return a figure with a network graph.
812
814
 
@@ -853,6 +855,8 @@ def fplot_network(
853
855
  node_list=node_list,
854
856
  ax=ax,
855
857
  )
858
+ if save_path:
859
+ fig.savefig(save_path, **(savefig_kwargs or {}))
856
860
  return fig
857
861
 
858
862
 
@@ -868,6 +872,8 @@ def fplot_network_components(
868
872
  node_list: Optional[List] = None,
869
873
  figsize: Tuple[float, float] = (19.2, 10.8),
870
874
  n_cols: Optional[int] = None,
875
+ save_path: Optional[str] = None,
876
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
871
877
  ) -> Figure:
872
878
  """Return a figure showing individual network components.
873
879
 
@@ -945,4 +951,6 @@ def fplot_network_components(
945
951
 
946
952
  plt.tight_layout(rect=(0, 0.03, 1, 0.95))
947
953
 
954
+ if save_path:
955
+ fig.savefig(save_path, **(savefig_kwargs or {}))
948
956
  return fig
MatplotLibAPI/Pie.py CHANGED
@@ -52,6 +52,8 @@ def fplot_pie_donut(
52
52
  title: Optional[str] = None,
53
53
  style: StyleTemplate = PIE_STYLE_TEMPLATE,
54
54
  figsize: Tuple[float, float] = (8, 8),
55
+ save_path: Optional[str] = None,
56
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
55
57
  ) -> Figure:
56
58
  """Plot pie or donut charts on a new figure."""
57
59
  return _wrap_aplot(
@@ -63,4 +65,6 @@ def fplot_pie_donut(
63
65
  donut=donut,
64
66
  title=title,
65
67
  style=style,
68
+ save_path=save_path,
69
+ savefig_kwargs=savefig_kwargs,
66
70
  )
MatplotLibAPI/Sankey.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Sankey plotting helpers."""
2
2
 
3
- from typing import Dict, List, Optional
3
+ from typing import Any, Dict, List, Optional
4
4
 
5
5
  import pandas as pd
6
6
  import plotly.graph_objects as go
@@ -15,6 +15,8 @@ def fplot_sankey(
15
15
  value: str,
16
16
  title: Optional[str] = None,
17
17
  style: StyleTemplate = SANKEY_STYLE_TEMPLATE,
18
+ save_path: Optional[str] = None,
19
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
18
20
  ) -> go.Figure:
19
21
  """Plot a Sankey diagram showing flows between categories."""
20
22
  validate_dataframe(pd_df, cols=[source, target, value])
@@ -36,4 +38,9 @@ def fplot_sankey(
36
38
  fig.update_layout(
37
39
  title_text=title, font=dict(color=style.font_color, size=style.font_size)
38
40
  )
41
+ if save_path:
42
+ if save_path.lower().endswith((".html", ".htm")):
43
+ fig.write_html(save_path, **(savefig_kwargs or {}))
44
+ else:
45
+ fig.write_image(save_path, **(savefig_kwargs or {}))
39
46
  return fig
MatplotLibAPI/Sunburst.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Sunburst chart plotting utilities."""
2
2
 
3
- from typing import Optional
3
+ from typing import Any, Dict, Optional
4
4
 
5
5
  import pandas as pd
6
6
  import plotly.graph_objects as go
@@ -23,6 +23,8 @@ def fplot_sunburst(
23
23
  ascending: bool = False,
24
24
  max_values: int = 100,
25
25
  fig: Optional[go.Figure] = None,
26
+ save_path: Optional[str] = None,
27
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
26
28
  ) -> go.Figure:
27
29
  """Return a figure containing the sunburst plot.
28
30
 
@@ -79,5 +81,9 @@ def fplot_sunburst(
79
81
  font=dict(family=style.font_name, size=style.font_size, color=style.font_color),
80
82
  showlegend=style.legend if style else True,
81
83
  )
82
-
84
+ if save_path:
85
+ if save_path.lower().endswith((".html", ".htm")):
86
+ fig.write_html(save_path, **(savefig_kwargs or {}))
87
+ else:
88
+ fig.write_image(save_path, **(savefig_kwargs or {}))
83
89
  return fig
MatplotLibAPI/Table.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Table plotting helpers."""
2
2
 
3
- from typing import List, Optional, Tuple, cast
3
+ from typing import Any, Dict, List, Optional, Tuple, cast
4
4
  import pandas as pd
5
5
  import matplotlib.pyplot as plt
6
6
  from matplotlib.axes import Axes
@@ -173,6 +173,8 @@ def fplot_table(
173
173
  sort_by: Optional[str] = None,
174
174
  ascending: bool = False,
175
175
  figsize: Tuple[float, float] = (19.2, 10.8),
176
+ save_path: Optional[str] = None,
177
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
176
178
  ) -> Figure:
177
179
  """Return a new figure containing a formatted table.
178
180
 
@@ -217,4 +219,6 @@ def fplot_table(
217
219
  fig.patch.set_facecolor(style.background_color)
218
220
  ax = fig.add_subplot()
219
221
  ax = aplot_table(pd_df, cols, title, style, max_values, sort_by, ascending, ax)
222
+ if save_path:
223
+ fig.savefig(save_path, **(savefig_kwargs or {}))
220
224
  return fig
@@ -1,6 +1,6 @@
1
1
  """Timeserie plotting helpers."""
2
2
 
3
- from typing import Dict, Optional, Tuple, cast
3
+ from typing import Any, Dict, Optional, Tuple, cast
4
4
 
5
5
  import matplotlib.pyplot as plt
6
6
  import pandas as pd
@@ -270,6 +270,8 @@ def fplot_timeserie(
270
270
  ascending: bool = False,
271
271
  std: bool = False,
272
272
  figsize: Tuple[float, float] = (19.2, 10.8),
273
+ save_path: Optional[str] = None,
274
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
273
275
  ) -> Figure:
274
276
  """Return a figure plotting the time series.
275
277
 
@@ -336,6 +338,8 @@ def fplot_timeserie(
336
338
  ascending=ascending,
337
339
  ax=ax,
338
340
  )
341
+ if save_path:
342
+ fig.savefig(save_path, **(savefig_kwargs or {}))
339
343
  return fig
340
344
 
341
345
 
MatplotLibAPI/Treemap.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Treemap plotting utilities."""
2
2
 
3
- from typing import Optional
3
+ from typing import Any, Dict, Optional
4
4
 
5
5
  import pandas as pd
6
6
  import plotly.graph_objects as go
@@ -103,6 +103,8 @@ def fplot_treemap(
103
103
  ascending: bool = False,
104
104
  max_values: int = 100,
105
105
  fig: Optional[go.Figure] = None,
106
+ save_path: Optional[str] = None,
107
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
106
108
  ) -> go.Figure:
107
109
  """Return a figure containing the treemap plot.
108
110
 
@@ -162,4 +164,9 @@ def fplot_treemap(
162
164
  # Apply color scale
163
165
  fig.update_traces(marker=dict(colorscale=style.palette))
164
166
 
167
+ if save_path:
168
+ if save_path.lower().endswith((".html", ".htm")):
169
+ fig.write_html(save_path, **(savefig_kwargs or {}))
170
+ else:
171
+ fig.write_image(save_path, **(savefig_kwargs or {}))
165
172
  return fig
MatplotLibAPI/Waffle.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Waffle chart helpers."""
2
2
 
3
- from typing import Any, Optional, Tuple
3
+ from typing import Any, Dict, Optional, Tuple
4
4
 
5
5
  import pandas as pd
6
6
  import seaborn as sns
@@ -68,6 +68,8 @@ def fplot_waffle(
68
68
  title: Optional[str] = None,
69
69
  style: StyleTemplate = PIE_STYLE_TEMPLATE,
70
70
  figsize: Tuple[float, float] = (8, 8),
71
+ save_path: Optional[str] = None,
72
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
71
73
  ) -> Figure:
72
74
  """Plot waffle charts on a new figure."""
73
75
  return _wrap_aplot(
@@ -79,4 +81,6 @@ def fplot_waffle(
79
81
  rows=rows,
80
82
  title=title,
81
83
  style=style,
84
+ save_path=save_path,
85
+ savefig_kwargs=savefig_kwargs,
82
86
  )
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Iterable, Optional, Sequence, Tuple, cast
5
+ from typing import Any, Dict, Iterable, Optional, Sequence, Tuple, cast
6
6
 
7
7
  import numpy as np
8
8
  import pandas as pd
@@ -10,6 +10,7 @@ import matplotlib.pyplot as plt
10
10
  from matplotlib import colormaps
11
11
  from matplotlib.axes import Axes
12
12
  from matplotlib.figure import Figure
13
+ from wordcloud import WordCloud
13
14
 
14
15
  from .StyleTemplate import (
15
16
  FIG_SIZE,
@@ -160,29 +161,43 @@ def _plot_words(
160
161
  matplotlib.axes.Axes
161
162
  Axes containing the rendered word cloud.
162
163
  """
163
- rng = np.random.default_rng(seed=random_state)
164
- font_sizes = _normalize_weights(weights, base_size=style.font_size)
165
- cmap = colormaps.get_cmap(style.palette)
166
-
167
164
  ax.set_facecolor(style.background_color)
168
165
  ax.axis("off")
169
166
 
170
- x_positions = rng.uniform(0.05, 0.95, size=len(words))
171
- y_positions = rng.uniform(0.05, 0.95, size=len(words))
172
-
173
- for idx, (word, weight) in enumerate(zip(words, weights)):
174
- size = font_sizes[idx]
175
- color = cmap(rng.random())
176
- ax.text(
177
- x_positions[idx],
178
- y_positions[idx],
179
- string_formatter(word),
180
- ha="center",
181
- va="center",
182
- fontsize=size,
183
- color=color,
184
- transform=ax.transAxes,
185
- )
167
+ if not words:
168
+ if title:
169
+ ax.set_title(title, color=style.font_color, fontsize=style.font_size * 1.5)
170
+ return ax
171
+
172
+ fig_obj = ax.get_figure()
173
+ if not isinstance(fig_obj, Figure):
174
+ raise RuntimeError("Axes is not associated with a Figure.")
175
+
176
+ canvas = fig_obj.canvas
177
+ if canvas is None:
178
+ raise RuntimeError("Figure does not have an attached canvas.")
179
+
180
+ canvas.draw()
181
+ ax_bbox = ax.get_window_extent()
182
+ width = max(int(ax_bbox.width), 1)
183
+ height = max(int(ax_bbox.height), 1)
184
+
185
+ frequency_map = {
186
+ string_formatter(word): weight for word, weight in zip(words, weights)
187
+ }
188
+
189
+ font_sizes = _normalize_weights(weights, base_size=style.font_size)
190
+ wc = WordCloud(
191
+ width=width,
192
+ height=height,
193
+ background_color=style.background_color,
194
+ colormap=colormaps.get_cmap(style.palette),
195
+ min_font_size=int(font_sizes.min(initial=style.font_size)),
196
+ max_font_size=int(font_sizes.max(initial=style.font_size * 4)),
197
+ random_state=random_state,
198
+ ).generate_from_frequencies(frequency_map)
199
+
200
+ ax.imshow(wc, interpolation="bilinear")
186
201
 
187
202
  if title:
188
203
  ax.set_title(title, color=style.font_color, fontsize=style.font_size * 1.5)
@@ -258,6 +273,8 @@ def fplot_wordcloud(
258
273
  stopwords: Optional[Iterable[str]] = None,
259
274
  random_state: Optional[int] = None,
260
275
  figsize: Tuple[float, float] = FIG_SIZE,
276
+ save_path: Optional[str] = None,
277
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
261
278
  ) -> Figure:
262
279
  """Create a new figure with a word cloud.
263
280
 
@@ -311,4 +328,6 @@ def fplot_wordcloud(
311
328
  )
312
329
  fig.patch.set_facecolor(style.background_color)
313
330
  fig.tight_layout()
331
+ if save_path:
332
+ fig.savefig(save_path, **(savefig_kwargs or {}))
314
333
  return fig
MatplotLibAPI/__init__.py CHANGED
@@ -17,6 +17,7 @@ from .Network import (
17
17
  NETWORK_STYLE_TEMPLATE,
18
18
  aplot_network,
19
19
  aplot_network_components,
20
+ fplot_network_components,
20
21
  fplot_network,
21
22
  prepare_network_graph,
22
23
  )
@@ -56,6 +57,7 @@ __all__ = [
56
57
  "aplot_waffle",
57
58
  "fplot_bubble",
58
59
  "fplot_network",
60
+ "fplot_network_components",
59
61
  "fplot_table",
60
62
  "fplot_timeserie",
61
63
  "fplot_wordcloud",
@@ -23,9 +23,37 @@ def _wrap_aplot(
23
23
  pd_df: Any,
24
24
  figsize: Tuple[float, float],
25
25
  ax_args: Optional[Dict[str, Any]] = None,
26
+ save_path: Optional[str] = None,
27
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
26
28
  **kwargs: Any,
27
29
  ) -> Figure:
28
- """Create a new figure and delegate plotting to an axis-level function."""
30
+ """Create a new figure and delegate plotting to an axis-level function.
31
+
32
+ Parameters
33
+ ----------
34
+ plot_func : _AplotFunc
35
+ Axis-level plotting callable.
36
+ pd_df : Any
37
+ Data passed to the plotting function.
38
+ figsize : tuple[float, float]
39
+ Size of the created figure.
40
+ ax_args : dict, optional
41
+ Additional keyword arguments forwarded to ``plt.subplots``.
42
+ save_path : str, optional
43
+ File path where the figure should be saved. The default is ``None``
44
+ and no file is written.
45
+ savefig_kwargs : dict, optional
46
+ Extra keyword arguments forwarded to ``Figure.savefig`` when
47
+ ``save_path`` is provided. Defaults to ``None``.
48
+ **kwargs : Any
49
+ Additional arguments forwarded to ``plot_func``.
50
+
51
+ Returns
52
+ -------
53
+ Figure
54
+ Figure containing the rendered plot. If ``save_path`` is supplied the
55
+ figure is saved before being returned.
56
+ """
29
57
  ax_args = ax_args or {}
30
58
  fig, axes_obj = plt.subplots(figsize=figsize, **ax_args)
31
59
  ax: Axes
@@ -35,4 +63,6 @@ def _wrap_aplot(
35
63
  ax = cast(Axes, axes_obj.flat[0] if isinstance(axes_obj, ndarray) else axes_obj)
36
64
  plot_func(pd_df=pd_df, ax=ax, **kwargs)
37
65
  fig_obj: Figure = cast(Figure, fig)
66
+ if save_path:
67
+ fig_obj.savefig(save_path, **(savefig_kwargs or {}))
38
68
  return fig_obj
MatplotLibAPI/accessor.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Pandas accessor exposing MatplotLibAPI plotting helpers."""
2
2
 
3
- from typing import Dict, List, Optional, Tuple
3
+ from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
5
  import numpy as np
6
6
  import pandas as pd
@@ -26,6 +26,7 @@ from .Network import (
26
26
  NETWORK_STYLE_TEMPLATE,
27
27
  aplot_network,
28
28
  aplot_network_components,
29
+ fplot_network_components,
29
30
  fplot_network,
30
31
  )
31
32
  from .Pie import aplot_pie_donut, fplot_pie_donut
@@ -112,6 +113,8 @@ class DataFrameAccessor:
112
113
  Plot connected components of a network graph on multiple axes.
113
114
  fplot_network
114
115
  Plot a network graph on a new figure.
116
+ fplot_network_components
117
+ Plot connected components of a network graph on a new figure.
115
118
  fplot_treemap
116
119
  Plot a treemap on a new Plotly figure.
117
120
  fplot_sunburst
@@ -208,6 +211,8 @@ class DataFrameAccessor:
208
211
  hline: bool = False,
209
212
  vline: bool = False,
210
213
  figsize: Tuple[float, float] = (19.2, 10.8),
214
+ save_path: Optional[str] = None,
215
+ savefig_kwargs: Optional[Dict[str, Any]] = None,
211
216
  ) -> Figure:
212
217
  """Plot a bubble chart on a new figure.
213
218
 
@@ -260,6 +265,8 @@ class DataFrameAccessor:
260
265
  hline=hline,
261
266
  vline=vline,
262
267
  figsize=figsize,
268
+ save_path=save_path,
269
+ savefig_kwargs=savefig_kwargs,
263
270
  )
264
271
 
265
272
  def fplot_composite_bubble(
@@ -1483,6 +1490,63 @@ class DataFrameAccessor:
1483
1490
  figsize=figsize,
1484
1491
  )
1485
1492
 
1493
+ def fplot_network_components(
1494
+ self,
1495
+ source: str = "source",
1496
+ target: str = "target",
1497
+ weight: str = "weight",
1498
+ title: Optional[str] = None,
1499
+ style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
1500
+ sort_by: Optional[str] = None,
1501
+ ascending: bool = False,
1502
+ node_list: Optional[List] = None,
1503
+ figsize: Tuple[float, float] = (19.2, 10.8),
1504
+ n_cols: Optional[int] = None,
1505
+ ) -> Figure:
1506
+ """Plot network components on a new figure.
1507
+
1508
+ Parameters
1509
+ ----------
1510
+ source : str, optional
1511
+ Column for source nodes. The default is "source".
1512
+ target : str, optional
1513
+ Column for target nodes. The default is "target".
1514
+ weight : str, optional
1515
+ Column for edge weights. The default is "weight".
1516
+ title : str, optional
1517
+ Chart title.
1518
+ style : StyleTemplate, optional
1519
+ Styling template. The default is `NETWORK_STYLE_TEMPLATE`.
1520
+ sort_by : str, optional
1521
+ Column to sort by.
1522
+ ascending : bool, optional
1523
+ Sort order. The default is `False`.
1524
+ node_list : list, optional
1525
+ List of nodes to include. If None, all nodes are used.
1526
+ figsize : tuple[float, float], optional
1527
+ Figure size. The default is (19.2, 10.8).
1528
+ n_cols : int, optional
1529
+ Number of columns for arranging component subplots.
1530
+
1531
+ Returns
1532
+ -------
1533
+ Figure
1534
+ The new Matplotlib figure with component plots.
1535
+ """
1536
+ return fplot_network_components(
1537
+ pd_df=self._obj,
1538
+ source=source,
1539
+ target=target,
1540
+ weight=weight,
1541
+ title=title,
1542
+ style=style,
1543
+ sort_by=sort_by,
1544
+ ascending=ascending,
1545
+ node_list=node_list,
1546
+ figsize=figsize,
1547
+ n_cols=n_cols,
1548
+ )
1549
+
1486
1550
  def fplot_treemap(
1487
1551
  self,
1488
1552
  path: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MatplotLibAPI
3
- Version: 3.2.16
3
+ Version: 3.2.18
4
4
  License-File: LICENSE
5
5
  Requires-Python: >=3.8
6
6
  Requires-Dist: kaleido
@@ -12,6 +12,7 @@ Requires-Dist: pandas
12
12
  Requires-Dist: plotly
13
13
  Requires-Dist: scikit-learn
14
14
  Requires-Dist: seaborn
15
+ Requires-Dist: wordcloud
15
16
  Provides-Extra: dev
16
17
  Requires-Dist: black; extra == 'dev'
17
18
  Requires-Dist: pydocstyle; extra == 'dev'
@@ -0,0 +1,26 @@
1
+ MatplotLibAPI/Area.py,sha256=Y-tk6Di3Foj3yOGVbbOwDnPtL9rDh-VV2XTeaZcybgk,2095
2
+ MatplotLibAPI/Bar.py,sha256=Y8mP_UWyU2h5T38L7j-Vnt0t9WSeCbV6Gw_-_48x3Bw,2243
3
+ MatplotLibAPI/BoxViolin.py,sha256=zsyfUKYp6wKD30i-LWmwPxtOA7ljjh874xxES_GHZ8M,1947
4
+ MatplotLibAPI/Bubble.py,sha256=xByA6J89L1ye8oiinGQx1jd4PC0vPcBQhxFrKCEXtVM,12814
5
+ MatplotLibAPI/Composite.py,sha256=k4elPk2mucw5oOH2S2GZV6mbHI9N4Nhpnte4mWLHObg,5902
6
+ MatplotLibAPI/Heatmap.py,sha256=SRT8pCKtEaJ1PivxxzCuXp-OBu4ljno2PGB_XXvFxzY,3369
7
+ MatplotLibAPI/Histogram.py,sha256=znkQAVOa2-DMIKopCl_3-8JpDtymfGm4Bi4IyNXSVqs,1869
8
+ MatplotLibAPI/Network.py,sha256=oxDPmhKWjkwGonL6xTDo_f-O5jKTrAGbvyV0kb4uUOI,30472
9
+ MatplotLibAPI/Pie.py,sha256=p0JuSP8h3TflEuvmGpPqNHO7hbAnse8hmMWBiZtzfsE,1882
10
+ MatplotLibAPI/Pivot.py,sha256=6qH8e6U1TzUQcAIBmA_KMuHER2Uxp0-GFtwy9eJuS9A,3403
11
+ MatplotLibAPI/Sankey.py,sha256=SpijCISghlsLqPuaWvnBP6vB-CV9k7FUGUi5LC6bKVc,1501
12
+ MatplotLibAPI/StyleTemplate.py,sha256=Y3sBbUMbfAuxaONW8YixaI0UGgC7b1xnUo0MUMV4Z98,8176
13
+ MatplotLibAPI/Sunburst.py,sha256=kqjEruXDDeuJpUKqbMw_VdT7fY0O4qzUNsIuwaTamdc,2584
14
+ MatplotLibAPI/Table.py,sha256=jRdnQ0LNA5op65QJhXnXv_v7tBv1JEPLX7qHNd07_is,6448
15
+ MatplotLibAPI/Timeserie.py,sha256=vN8Ed9eC6TcN02LAiSJRzbIW3ZNoBo8ip7lznnK5eG0,10198
16
+ MatplotLibAPI/Treemap.py,sha256=VBBk6MpNXoQtnxFzR1YPhIx6Lz9b7yJNHBMbQDhvefM,4848
17
+ MatplotLibAPI/Waffle.py,sha256=uplRhUBDWUhSwPnI_GzU1O2D_RQXW_0OJ51m01PFKLg,2517
18
+ MatplotLibAPI/Wordcloud.py,sha256=sE6P8vCh8H6bQnaIr4LPW7fd3-OQootfOuM-9-htgv4,10016
19
+ MatplotLibAPI/__init__.py,sha256=6Z51NTmLCoM7P-XPDGVQdtcXtz8S1zZzoByuX_nCpyw,2233
20
+ MatplotLibAPI/_typing.py,sha256=Or3IPNceWKdyEk3CGXJb09FZR_fvT732oF0iWrx1ex8,598
21
+ MatplotLibAPI/_visualization_utils.py,sha256=qIv7c0Mi3qK-saGxmKngw23uWxKFSAYjiH3uYTSr5Po,2215
22
+ MatplotLibAPI/accessor.py,sha256=Wsje4q6bNa_-WAkljqTDWfbWpKcbAy2JKaHir9qZ9Ho,53038
23
+ matplotlibapi-3.2.18.dist-info/METADATA,sha256=75mgiIyrEAbZsWAhIVTl6OzJax5iW6dANKSMdV1a4yE,5888
24
+ matplotlibapi-3.2.18.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
25
+ matplotlibapi-3.2.18.dist-info/licenses/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
26
+ matplotlibapi-3.2.18.dist-info/RECORD,,
@@ -1,26 +0,0 @@
1
- MatplotLibAPI/Area.py,sha256=cGStEYunusfJdkKOF4199l5LH-ZV-xk8Pe8RAeBaPt8,1931
2
- MatplotLibAPI/Bar.py,sha256=WY74gXJA3ZIpJD0WaidMo0lrT1lVEbeA0UMGFBY5yiE,2079
3
- MatplotLibAPI/BoxViolin.py,sha256=XB4cUxUvf8LzwE2twu0gd7vn2NJYjz_mQwVqtyE7dYU,1783
4
- MatplotLibAPI/Bubble.py,sha256=PiK6Fe77mXRTSSewXkimrNFsMa32pGRXr9jlgZJndXA,12644
5
- MatplotLibAPI/Composite.py,sha256=k4elPk2mucw5oOH2S2GZV6mbHI9N4Nhpnte4mWLHObg,5902
6
- MatplotLibAPI/Heatmap.py,sha256=Qs17CHGhBDXUVDxW0dofzjO5xxlQw5XIwANtUKHgg_Y,3047
7
- MatplotLibAPI/Histogram.py,sha256=0J4uC7xy53TZKjTDWCeEjaELL7E5lQDG0MpeGfaaO6Y,1705
8
- MatplotLibAPI/Network.py,sha256=erjKzl1Jb6j6Fiy3170xKSeF1LEBe7jPdLB6q8VZclw,30142
9
- MatplotLibAPI/Pie.py,sha256=TBAnj4mVYy6dKPMwXPjGanTDrLrjHmA5pFvrdXbNw9A,1724
10
- MatplotLibAPI/Pivot.py,sha256=6qH8e6U1TzUQcAIBmA_KMuHER2Uxp0-GFtwy9eJuS9A,3403
11
- MatplotLibAPI/Sankey.py,sha256=Q_zmEcER8PGPDro6W4R_SEs17ejfi6D0q-kH6mxkFcI,1187
12
- MatplotLibAPI/StyleTemplate.py,sha256=Y3sBbUMbfAuxaONW8YixaI0UGgC7b1xnUo0MUMV4Z98,8176
13
- MatplotLibAPI/Sunburst.py,sha256=ksPV5D40FQcVXQQ1QOHYMc0WMCcjmt9iRrbeH4g85uE,2265
14
- MatplotLibAPI/Table.py,sha256=EBxXJA6GKjFhWcOMwJ6Wfm-UNw3Ha5KBZ2004TYdkKY,6272
15
- MatplotLibAPI/Timeserie.py,sha256=s6u68IlugqPMpJk-X5hr-k1WDZyx97Ov7VKQOztXo_U,10028
16
- MatplotLibAPI/Treemap.py,sha256=a-9Z-ZzXzIV5SDgdJaW7slGELFBBks1pXZnIjcYmarw,4528
17
- MatplotLibAPI/Waffle.py,sha256=gPREV5v92DQcvjNGuwdKDbAaRSzLBbGF8sWPGUwFyJM,2353
18
- MatplotLibAPI/Wordcloud.py,sha256=b0vXLRjclSDr28o6LSXqnQenT7duZMmldmfyLrNOVro,9333
19
- MatplotLibAPI/__init__.py,sha256=StUMlDJehHrO_LMCxmmMX3NpT0Ua_POCZ8GcHHpsQ5Y,2171
20
- MatplotLibAPI/_typing.py,sha256=Or3IPNceWKdyEk3CGXJb09FZR_fvT732oF0iWrx1ex8,598
21
- MatplotLibAPI/_visualization_utils.py,sha256=RQBgS-ytPorEOuWqQMHJRwaKOgmZoMW22-sjzxkui2I,1179
22
- MatplotLibAPI/accessor.py,sha256=LTvDlq8UXrL1YSyxQqQHE_tqI8jo4CFu2wEiknk4UFg,50808
23
- matplotlibapi-3.2.16.dist-info/METADATA,sha256=F2vLApzlN6stE-q2et8sdBGMuuO1N4aDx7TeLK4xKIE,5863
24
- matplotlibapi-3.2.16.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
25
- matplotlibapi-3.2.16.dist-info/licenses/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
26
- matplotlibapi-3.2.16.dist-info/RECORD,,