MatplotLibAPI 3.2.19__py3-none-any.whl → 3.2.20__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/BoxViolin.py +4 -2
- MatplotLibAPI/Wordcloud.py +13 -33
- {matplotlibapi-3.2.19.dist-info → matplotlibapi-3.2.20.dist-info}/METADATA +1 -1
- {matplotlibapi-3.2.19.dist-info → matplotlibapi-3.2.20.dist-info}/RECORD +6 -6
- {matplotlibapi-3.2.19.dist-info → matplotlibapi-3.2.20.dist-info}/WHEEL +0 -0
- {matplotlibapi-3.2.19.dist-info → matplotlibapi-3.2.20.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/BoxViolin.py
CHANGED
|
@@ -33,10 +33,12 @@ def aplot_box_violin(
|
|
|
33
33
|
validate_dataframe(pd_df, cols=cols)
|
|
34
34
|
plot_ax = _get_axis(ax)
|
|
35
35
|
|
|
36
|
+
common_kwargs = {"data": pd_df, "x": by, "y": column, "palette": style.palette}
|
|
37
|
+
|
|
36
38
|
if violin:
|
|
37
|
-
sns.violinplot(
|
|
39
|
+
sns.violinplot(**common_kwargs, hue=by, legend=False, ax=plot_ax)
|
|
38
40
|
else:
|
|
39
|
-
sns.boxplot(
|
|
41
|
+
sns.boxplot(**common_kwargs, hue=by, legend=False, ax=plot_ax)
|
|
40
42
|
|
|
41
43
|
plot_ax.set_facecolor(style.background_color)
|
|
42
44
|
plot_ax.set_ylabel(string_formatter(column))
|
MatplotLibAPI/Wordcloud.py
CHANGED
|
@@ -25,33 +25,6 @@ WORDCLOUD_STYLE_TEMPLATE = StyleTemplate(
|
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
def _normalize_weights(weights: Sequence[float], base_size: int) -> np.ndarray:
|
|
29
|
-
"""Normalize weights to a range of font sizes.
|
|
30
|
-
|
|
31
|
-
Parameters
|
|
32
|
-
----------
|
|
33
|
-
weights : Sequence[float]
|
|
34
|
-
Sequence of weights representing word importance.
|
|
35
|
-
base_size : int
|
|
36
|
-
Base font size used as the lower bound for scaling.
|
|
37
|
-
|
|
38
|
-
Returns
|
|
39
|
-
-------
|
|
40
|
-
numpy.ndarray
|
|
41
|
-
Array of font sizes corresponding to the provided weights.
|
|
42
|
-
"""
|
|
43
|
-
numeric_weights = np.asarray(weights, dtype=float)
|
|
44
|
-
if numeric_weights.size == 0:
|
|
45
|
-
return np.array([], dtype=float)
|
|
46
|
-
min_weight = numeric_weights.min()
|
|
47
|
-
max_weight = numeric_weights.max()
|
|
48
|
-
if min_weight == max_weight:
|
|
49
|
-
return np.full_like(numeric_weights, fill_value=base_size, dtype=float)
|
|
50
|
-
|
|
51
|
-
min_size, max_size = base_size, base_size * 4
|
|
52
|
-
return np.interp(numeric_weights, (min_weight, max_weight), (min_size, max_size))
|
|
53
|
-
|
|
54
|
-
|
|
55
28
|
def _filter_stopwords(
|
|
56
29
|
words: Iterable[str], stopwords: Optional[Iterable[str]]
|
|
57
30
|
) -> np.ndarray:
|
|
@@ -232,20 +205,21 @@ def _plot_words(
|
|
|
232
205
|
frequency_map = {
|
|
233
206
|
string_formatter(word): weight for word, weight in zip(words, weights)
|
|
234
207
|
}
|
|
208
|
+
min_font_size = style.font_mapping[min(style.font_mapping.keys())]
|
|
209
|
+
max_font_size = style.font_mapping[max(style.font_mapping.keys())]
|
|
235
210
|
|
|
236
|
-
font_sizes = _normalize_weights(weights, base_size=style.font_size)
|
|
237
211
|
wc = WordCloud(
|
|
238
212
|
width=width,
|
|
239
213
|
height=height,
|
|
240
214
|
background_color=style.background_color,
|
|
241
215
|
colormap=colormaps.get_cmap(style.palette),
|
|
242
|
-
min_font_size=
|
|
243
|
-
max_font_size=
|
|
216
|
+
min_font_size=min_font_size,
|
|
217
|
+
max_font_size=max_font_size,
|
|
244
218
|
random_state=random_state,
|
|
245
219
|
mask=resolved_mask,
|
|
246
220
|
).generate_from_frequencies(frequency_map)
|
|
247
221
|
|
|
248
|
-
ax.imshow(wc, interpolation="bilinear")
|
|
222
|
+
ax.imshow(wc.to_array(), interpolation="bilinear")
|
|
249
223
|
|
|
250
224
|
if title:
|
|
251
225
|
ax.set_title(title, color=style.font_color, fontsize=style.font_size * 1.5)
|
|
@@ -261,7 +235,7 @@ def aplot_wordcloud(
|
|
|
261
235
|
max_words: int = MAX_RESULTS,
|
|
262
236
|
stopwords: Optional[Iterable[str]] = None,
|
|
263
237
|
random_state: Optional[int] = None,
|
|
264
|
-
ax: Optional[Axes] = None,
|
|
238
|
+
ax: Optional[Axes | np.ndarray[Any, np.dtype[Any]]] = None,
|
|
265
239
|
mask: Optional[np.ndarray] = None,
|
|
266
240
|
) -> Axes:
|
|
267
241
|
"""Plot a word cloud on the provided axes.
|
|
@@ -284,7 +258,7 @@ def aplot_wordcloud(
|
|
|
284
258
|
Words to exclude from the visualization. Defaults to ``None``.
|
|
285
259
|
random_state : int, optional
|
|
286
260
|
Seed for word placement. Defaults to ``None``.
|
|
287
|
-
ax : matplotlib.axes.Axes, optional
|
|
261
|
+
ax : matplotlib.axes.Axes or numpy.ndarray, optional
|
|
288
262
|
Axes to draw on. Defaults to ``None`` which uses the current axes.
|
|
289
263
|
mask : numpy.ndarray, optional
|
|
290
264
|
Two-dimensional mask array defining the drawable region of the word cloud.
|
|
@@ -299,9 +273,15 @@ def aplot_wordcloud(
|
|
|
299
273
|
------
|
|
300
274
|
AttributeError
|
|
301
275
|
If required columns are missing from the DataFrame.
|
|
276
|
+
TypeError
|
|
277
|
+
If ``ax`` is not a ``matplotlib.axes.Axes`` instance.
|
|
302
278
|
"""
|
|
303
279
|
if ax is None:
|
|
304
280
|
ax = cast(Axes, plt.gca())
|
|
281
|
+
elif isinstance(ax, np.ndarray):
|
|
282
|
+
raise TypeError("ax must be a single matplotlib Axes instance, not an array.")
|
|
283
|
+
elif not isinstance(ax, Axes):
|
|
284
|
+
raise TypeError("ax must be a matplotlib Axes instance.")
|
|
305
285
|
|
|
306
286
|
words, weights = _prepare_word_frequencies(
|
|
307
287
|
pd_df=pd_df,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MatplotLibAPI/Area.py,sha256=Y-tk6Di3Foj3yOGVbbOwDnPtL9rDh-VV2XTeaZcybgk,2095
|
|
2
2
|
MatplotLibAPI/Bar.py,sha256=Y8mP_UWyU2h5T38L7j-Vnt0t9WSeCbV6Gw_-_48x3Bw,2243
|
|
3
|
-
MatplotLibAPI/BoxViolin.py,sha256=
|
|
3
|
+
MatplotLibAPI/BoxViolin.py,sha256=8nnXGyDwrjiNJOiJHEYEcJMqD6JIF5JT8aZ0y4AXgLY,2008
|
|
4
4
|
MatplotLibAPI/Bubble.py,sha256=xByA6J89L1ye8oiinGQx1jd4PC0vPcBQhxFrKCEXtVM,12814
|
|
5
5
|
MatplotLibAPI/Composite.py,sha256=k4elPk2mucw5oOH2S2GZV6mbHI9N4Nhpnte4mWLHObg,5902
|
|
6
6
|
MatplotLibAPI/Heatmap.py,sha256=SRT8pCKtEaJ1PivxxzCuXp-OBu4ljno2PGB_XXvFxzY,3369
|
|
@@ -15,12 +15,12 @@ MatplotLibAPI/Table.py,sha256=jRdnQ0LNA5op65QJhXnXv_v7tBv1JEPLX7qHNd07_is,6448
|
|
|
15
15
|
MatplotLibAPI/Timeserie.py,sha256=vN8Ed9eC6TcN02LAiSJRzbIW3ZNoBo8ip7lznnK5eG0,10198
|
|
16
16
|
MatplotLibAPI/Treemap.py,sha256=VBBk6MpNXoQtnxFzR1YPhIx6Lz9b7yJNHBMbQDhvefM,4848
|
|
17
17
|
MatplotLibAPI/Waffle.py,sha256=uplRhUBDWUhSwPnI_GzU1O2D_RQXW_0OJ51m01PFKLg,2517
|
|
18
|
-
MatplotLibAPI/Wordcloud.py,sha256=
|
|
18
|
+
MatplotLibAPI/Wordcloud.py,sha256=uYH8amxRpMm0y60Ch9nkOl2yXNX-l01NZe2VGIwdZw8,11581
|
|
19
19
|
MatplotLibAPI/__init__.py,sha256=jyMVtJq3rGJ9GmM7mX1dhJcNCCJHJ2-IwtDClRgKBFg,2304
|
|
20
20
|
MatplotLibAPI/_typing.py,sha256=Or3IPNceWKdyEk3CGXJb09FZR_fvT732oF0iWrx1ex8,598
|
|
21
21
|
MatplotLibAPI/_visualization_utils.py,sha256=qIv7c0Mi3qK-saGxmKngw23uWxKFSAYjiH3uYTSr5Po,2215
|
|
22
22
|
MatplotLibAPI/accessor.py,sha256=Wsje4q6bNa_-WAkljqTDWfbWpKcbAy2JKaHir9qZ9Ho,53038
|
|
23
|
-
matplotlibapi-3.2.
|
|
24
|
-
matplotlibapi-3.2.
|
|
25
|
-
matplotlibapi-3.2.
|
|
26
|
-
matplotlibapi-3.2.
|
|
23
|
+
matplotlibapi-3.2.20.dist-info/METADATA,sha256=ocDaj9BvTZvdA3hs30komzhrlyfspk6MaZEVmq2q0Xw,5888
|
|
24
|
+
matplotlibapi-3.2.20.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
25
|
+
matplotlibapi-3.2.20.dist-info/licenses/LICENSE,sha256=hMErKLb6YZR3lRR5zr-vxeFkvY69QAaafgSpZ5-P1dQ,1067
|
|
26
|
+
matplotlibapi-3.2.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|