MatplotLibAPI 3.2.16__py3-none-any.whl → 3.2.17__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/Wordcloud.py +35 -20
- MatplotLibAPI/__init__.py +2 -0
- MatplotLibAPI/accessor.py +60 -0
- {matplotlibapi-3.2.16.dist-info → matplotlibapi-3.2.17.dist-info}/METADATA +2 -1
- {matplotlibapi-3.2.16.dist-info → matplotlibapi-3.2.17.dist-info}/RECORD +7 -7
- {matplotlibapi-3.2.16.dist-info → matplotlibapi-3.2.17.dist-info}/WHEEL +0 -0
- {matplotlibapi-3.2.16.dist-info → matplotlibapi-3.2.17.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/Wordcloud.py
CHANGED
|
@@ -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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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)
|
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",
|
MatplotLibAPI/accessor.py
CHANGED
|
@@ -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
|
|
@@ -1483,6 +1486,63 @@ class DataFrameAccessor:
|
|
|
1483
1486
|
figsize=figsize,
|
|
1484
1487
|
)
|
|
1485
1488
|
|
|
1489
|
+
def fplot_network_components(
|
|
1490
|
+
self,
|
|
1491
|
+
source: str = "source",
|
|
1492
|
+
target: str = "target",
|
|
1493
|
+
weight: str = "weight",
|
|
1494
|
+
title: Optional[str] = None,
|
|
1495
|
+
style: StyleTemplate = NETWORK_STYLE_TEMPLATE,
|
|
1496
|
+
sort_by: Optional[str] = None,
|
|
1497
|
+
ascending: bool = False,
|
|
1498
|
+
node_list: Optional[List] = None,
|
|
1499
|
+
figsize: Tuple[float, float] = (19.2, 10.8),
|
|
1500
|
+
n_cols: Optional[int] = None,
|
|
1501
|
+
) -> Figure:
|
|
1502
|
+
"""Plot network components on a new figure.
|
|
1503
|
+
|
|
1504
|
+
Parameters
|
|
1505
|
+
----------
|
|
1506
|
+
source : str, optional
|
|
1507
|
+
Column for source nodes. The default is "source".
|
|
1508
|
+
target : str, optional
|
|
1509
|
+
Column for target nodes. The default is "target".
|
|
1510
|
+
weight : str, optional
|
|
1511
|
+
Column for edge weights. The default is "weight".
|
|
1512
|
+
title : str, optional
|
|
1513
|
+
Chart title.
|
|
1514
|
+
style : StyleTemplate, optional
|
|
1515
|
+
Styling template. The default is `NETWORK_STYLE_TEMPLATE`.
|
|
1516
|
+
sort_by : str, optional
|
|
1517
|
+
Column to sort by.
|
|
1518
|
+
ascending : bool, optional
|
|
1519
|
+
Sort order. The default is `False`.
|
|
1520
|
+
node_list : list, optional
|
|
1521
|
+
List of nodes to include. If None, all nodes are used.
|
|
1522
|
+
figsize : tuple[float, float], optional
|
|
1523
|
+
Figure size. The default is (19.2, 10.8).
|
|
1524
|
+
n_cols : int, optional
|
|
1525
|
+
Number of columns for arranging component subplots.
|
|
1526
|
+
|
|
1527
|
+
Returns
|
|
1528
|
+
-------
|
|
1529
|
+
Figure
|
|
1530
|
+
The new Matplotlib figure with component plots.
|
|
1531
|
+
"""
|
|
1532
|
+
return fplot_network_components(
|
|
1533
|
+
pd_df=self._obj,
|
|
1534
|
+
source=source,
|
|
1535
|
+
target=target,
|
|
1536
|
+
weight=weight,
|
|
1537
|
+
title=title,
|
|
1538
|
+
style=style,
|
|
1539
|
+
sort_by=sort_by,
|
|
1540
|
+
ascending=ascending,
|
|
1541
|
+
node_list=node_list,
|
|
1542
|
+
figsize=figsize,
|
|
1543
|
+
n_cols=n_cols,
|
|
1544
|
+
)
|
|
1545
|
+
|
|
1486
1546
|
def fplot_treemap(
|
|
1487
1547
|
self,
|
|
1488
1548
|
path: str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MatplotLibAPI
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.17
|
|
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'
|
|
@@ -15,12 +15,12 @@ MatplotLibAPI/Table.py,sha256=EBxXJA6GKjFhWcOMwJ6Wfm-UNw3Ha5KBZ2004TYdkKY,6272
|
|
|
15
15
|
MatplotLibAPI/Timeserie.py,sha256=s6u68IlugqPMpJk-X5hr-k1WDZyx97Ov7VKQOztXo_U,10028
|
|
16
16
|
MatplotLibAPI/Treemap.py,sha256=a-9Z-ZzXzIV5SDgdJaW7slGELFBBks1pXZnIjcYmarw,4528
|
|
17
17
|
MatplotLibAPI/Waffle.py,sha256=gPREV5v92DQcvjNGuwdKDbAaRSzLBbGF8sWPGUwFyJM,2353
|
|
18
|
-
MatplotLibAPI/Wordcloud.py,sha256=
|
|
19
|
-
MatplotLibAPI/__init__.py,sha256=
|
|
18
|
+
MatplotLibAPI/Wordcloud.py,sha256=aQnLQ4AxHaa2-6PE3ThbmjoQF4DN4oYTaRgRur_evRc,9840
|
|
19
|
+
MatplotLibAPI/__init__.py,sha256=6Z51NTmLCoM7P-XPDGVQdtcXtz8S1zZzoByuX_nCpyw,2233
|
|
20
20
|
MatplotLibAPI/_typing.py,sha256=Or3IPNceWKdyEk3CGXJb09FZR_fvT732oF0iWrx1ex8,598
|
|
21
21
|
MatplotLibAPI/_visualization_utils.py,sha256=RQBgS-ytPorEOuWqQMHJRwaKOgmZoMW22-sjzxkui2I,1179
|
|
22
|
-
MatplotLibAPI/accessor.py,sha256=
|
|
23
|
-
matplotlibapi-3.2.
|
|
24
|
-
matplotlibapi-3.2.
|
|
25
|
-
matplotlibapi-3.2.
|
|
26
|
-
matplotlibapi-3.2.
|
|
22
|
+
MatplotLibAPI/accessor.py,sha256=jcLrMP30v_G4rMNV1_peM-_cpxk6bIh11snvHGAUUpE,52859
|
|
23
|
+
matplotlibapi-3.2.17.dist-info/METADATA,sha256=g6-L4pc_nY0GtaopfPavA5ANDLVyhd7fTJ-McH6VNYo,5888
|
|
24
|
+
matplotlibapi-3.2.17.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
25
|
+
matplotlibapi-3.2.17.dist-info/licenses/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
|
|
26
|
+
matplotlibapi-3.2.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|