MatplotLibAPI 4.0.1__py3-none-any.whl → 4.0.2__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/accessor.py +90 -377
- MatplotLibAPI/area.py +5 -35
- MatplotLibAPI/bar.py +0 -34
- MatplotLibAPI/base_plot.py +45 -21
- MatplotLibAPI/box_violin.py +3 -38
- MatplotLibAPI/bubble.py +3 -148
- MatplotLibAPI/composite.py +7 -4
- MatplotLibAPI/heatmap.py +69 -54
- MatplotLibAPI/histogram.py +0 -20
- MatplotLibAPI/network/__init__.py +2 -0
- MatplotLibAPI/network/core.py +45 -54
- MatplotLibAPI/network/plot.py +95 -6
- MatplotLibAPI/pie.py +0 -36
- MatplotLibAPI/pivot.py +0 -23
- MatplotLibAPI/table.py +0 -26
- MatplotLibAPI/timeserie.py +0 -28
- MatplotLibAPI/treemap.py +3 -1
- MatplotLibAPI/typing.py +1 -4
- MatplotLibAPI/utils.py +26 -0
- MatplotLibAPI/waffle.py +0 -40
- MatplotLibAPI/word_cloud.py +4 -54
- {matplotlibapi-4.0.1.dist-info → matplotlibapi-4.0.2.dist-info}/METADATA +4 -4
- matplotlibapi-4.0.2.dist-info/RECORD +36 -0
- matplotlibapi-4.0.1.dist-info/RECORD +0 -36
- {matplotlibapi-4.0.1.dist-info → matplotlibapi-4.0.2.dist-info}/WHEEL +0 -0
- {matplotlibapi-4.0.1.dist-info → matplotlibapi-4.0.2.dist-info}/entry_points.txt +0 -0
- {matplotlibapi-4.0.1.dist-info → matplotlibapi-4.0.2.dist-info}/licenses/LICENSE +0 -0
MatplotLibAPI/area.py
CHANGED
|
@@ -14,7 +14,7 @@ from .style_template import (
|
|
|
14
14
|
string_formatter,
|
|
15
15
|
validate_dataframe,
|
|
16
16
|
)
|
|
17
|
-
from .utils import _get_axis, _merge_kwargs
|
|
17
|
+
from .utils import _get_axis, _merge_kwargs, create_fig
|
|
18
18
|
|
|
19
19
|
__all__ = ["AREA_STYLE_TEMPLATE", "aplot_area", "fplot_area"]
|
|
20
20
|
|
|
@@ -113,7 +113,7 @@ class AreaChart(BasePlot):
|
|
|
113
113
|
def aplot(
|
|
114
114
|
self,
|
|
115
115
|
title: Optional[str] = None,
|
|
116
|
-
style: StyleTemplate =
|
|
116
|
+
style: Optional[StyleTemplate] = None,
|
|
117
117
|
ax: Optional[Axes] = None,
|
|
118
118
|
**kwargs: Any,
|
|
119
119
|
) -> Axes:
|
|
@@ -135,6 +135,8 @@ class AreaChart(BasePlot):
|
|
|
135
135
|
Axes
|
|
136
136
|
The Matplotlib axes containing the area chart.
|
|
137
137
|
"""
|
|
138
|
+
if not style:
|
|
139
|
+
style = AREA_STYLE_TEMPLATE
|
|
138
140
|
plot_ax = _get_axis(ax)
|
|
139
141
|
plot_ax.set_facecolor(style.background_color)
|
|
140
142
|
|
|
@@ -150,38 +152,6 @@ class AreaChart(BasePlot):
|
|
|
150
152
|
plot_ax.set_title(title)
|
|
151
153
|
return plot_ax
|
|
152
154
|
|
|
153
|
-
def fplot(
|
|
154
|
-
self,
|
|
155
|
-
title: Optional[str] = None,
|
|
156
|
-
style: StyleTemplate = AREA_STYLE_TEMPLATE,
|
|
157
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
158
|
-
**kwargs: Any,
|
|
159
|
-
) -> Figure:
|
|
160
|
-
"""Plot an area chart on a new figure.
|
|
161
|
-
|
|
162
|
-
Parameters
|
|
163
|
-
----------
|
|
164
|
-
title : str, optional
|
|
165
|
-
Title for the plot. The default is None.
|
|
166
|
-
style : StyleTemplate, optional
|
|
167
|
-
Style template for the plot. The default is AREA_STYLE_TEMPLATE.
|
|
168
|
-
figsize : tuple[float, float], optional
|
|
169
|
-
Figure size. The default is (10, 6).
|
|
170
|
-
|
|
171
|
-
**kwargs : Any
|
|
172
|
-
Additional keyword arguments forwarded to ``aplot``.
|
|
173
|
-
|
|
174
|
-
Returns
|
|
175
|
-
-------
|
|
176
|
-
Figure
|
|
177
|
-
The Matplotlib figure containing the area chart.
|
|
178
|
-
"""
|
|
179
|
-
fig = Figure(figsize=figsize)
|
|
180
|
-
fig.set_facecolor(style.background_color)
|
|
181
|
-
ax = fig.add_subplot(111)
|
|
182
|
-
self.aplot(title=title, style=style, ax=ax, **kwargs)
|
|
183
|
-
return fig
|
|
184
|
-
|
|
185
155
|
|
|
186
156
|
def aplot_area(
|
|
187
157
|
pd_df: pd.DataFrame,
|
|
@@ -190,7 +160,7 @@ def aplot_area(
|
|
|
190
160
|
label: Optional[str] = None,
|
|
191
161
|
stacked: bool = True,
|
|
192
162
|
title: Optional[str] = None,
|
|
193
|
-
style: StyleTemplate =
|
|
163
|
+
style: Optional[StyleTemplate] = None,
|
|
194
164
|
ax: Optional[Axes] = None,
|
|
195
165
|
**kwargs: Any,
|
|
196
166
|
) -> Axes:
|
MatplotLibAPI/bar.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
from typing import Any, Optional, Tuple
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
6
|
-
import matplotlib.pyplot as plt
|
|
7
6
|
import seaborn as sns
|
|
8
7
|
from matplotlib.axes import Axes
|
|
9
8
|
from matplotlib.figure import Figure
|
|
@@ -109,39 +108,6 @@ class BarChart(BasePlot):
|
|
|
109
108
|
plot_ax.tick_params(axis="x", labelrotation=45)
|
|
110
109
|
return plot_ax
|
|
111
110
|
|
|
112
|
-
def fplot(
|
|
113
|
-
self,
|
|
114
|
-
title: Optional[str] = None,
|
|
115
|
-
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
116
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
117
|
-
) -> Figure:
|
|
118
|
-
"""Plot bar or stacked bar charts on a new figure.
|
|
119
|
-
|
|
120
|
-
Parameters
|
|
121
|
-
----------
|
|
122
|
-
title : str, optional
|
|
123
|
-
Title for the plot, by default None.
|
|
124
|
-
style : StyleTemplate, optional
|
|
125
|
-
Style template for the plot, by default DISTRIBUTION_STYLE_TEMPLATE.
|
|
126
|
-
figsize : tuple[float, float], optional
|
|
127
|
-
The size of the figure, by default (10, 6).
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
Figure
|
|
132
|
-
The Matplotlib Figure object containing the plot.
|
|
133
|
-
"""
|
|
134
|
-
fig = Figure(
|
|
135
|
-
figsize=figsize,
|
|
136
|
-
facecolor=style.background_color,
|
|
137
|
-
edgecolor=style.background_color,
|
|
138
|
-
)
|
|
139
|
-
ax = fig.add_subplot(111)
|
|
140
|
-
ax.set_facecolor(style.background_color)
|
|
141
|
-
fig.set_facecolor(style.background_color)
|
|
142
|
-
self.aplot(title=title, style=style, ax=ax)
|
|
143
|
-
return fig
|
|
144
|
-
|
|
145
111
|
|
|
146
112
|
def aplot_bar(
|
|
147
113
|
pd_df: pd.DataFrame,
|
MatplotLibAPI/base_plot.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"""Abstract base class for all plot types."""
|
|
2
2
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
|
-
from typing import Any, Optional
|
|
4
|
+
from typing import Any, Optional, Tuple, cast
|
|
5
5
|
|
|
6
6
|
import pandas as pd
|
|
7
|
+
import matplotlib.pyplot as plt
|
|
7
8
|
from matplotlib.axes import Axes
|
|
8
9
|
from matplotlib.figure import Figure
|
|
9
10
|
|
|
10
|
-
from .style_template import StyleTemplate
|
|
11
|
+
from .style_template import StyleTemplate, FIG_SIZE
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class BasePlot(ABC):
|
|
@@ -38,8 +39,6 @@ class BasePlot(ABC):
|
|
|
38
39
|
|
|
39
40
|
Parameters
|
|
40
41
|
----------
|
|
41
|
-
pd_df : pd.DataFrame
|
|
42
|
-
The input DataFrame to plot.
|
|
43
42
|
*args : Any
|
|
44
43
|
Plot-specific positional arguments.
|
|
45
44
|
**kwargs : Any
|
|
@@ -58,31 +57,56 @@ class BasePlot(ABC):
|
|
|
58
57
|
The Matplotlib axes object with the plot.
|
|
59
58
|
"""
|
|
60
59
|
|
|
61
|
-
@abstractmethod
|
|
62
60
|
def fplot(self, *args: Any, **kwargs: Any) -> Figure:
|
|
63
|
-
"""Plot on a new
|
|
64
|
-
|
|
65
|
-
Subclasses should implement plot-specific parameters as needed.
|
|
66
|
-
Common parameters include title, style, and figsize.
|
|
61
|
+
"""Plot on a new figure using the axis-level implementation.
|
|
67
62
|
|
|
68
63
|
Parameters
|
|
69
64
|
----------
|
|
70
|
-
pd_df : pd.DataFrame
|
|
71
|
-
The input DataFrame to plot.
|
|
72
65
|
*args : Any
|
|
73
|
-
Plot-specific positional arguments
|
|
66
|
+
Plot-specific positional arguments forwarded to ``aplot``.
|
|
74
67
|
**kwargs : Any
|
|
75
|
-
Plot-specific keyword arguments
|
|
76
|
-
|
|
77
|
-
Chart title.
|
|
78
|
-
- style : StyleTemplate, optional
|
|
79
|
-
Styling template.
|
|
80
|
-
- figsize : tuple, optional
|
|
81
|
-
Figure size as (width, height).
|
|
82
|
-
- Additional plot-specific parameters.
|
|
68
|
+
Plot-specific keyword arguments forwarded to ``aplot``.
|
|
69
|
+
``figsize`` is consumed to create the figure.
|
|
83
70
|
|
|
84
71
|
Returns
|
|
85
72
|
-------
|
|
86
73
|
Figure
|
|
87
|
-
The Matplotlib figure
|
|
74
|
+
The Matplotlib figure containing the rendered plot.
|
|
75
|
+
"""
|
|
76
|
+
style: Optional[StyleTemplate] = kwargs.get("style")
|
|
77
|
+
if style is None:
|
|
78
|
+
style = StyleTemplate()
|
|
79
|
+
plot_kwargs = {k: v for k, v in kwargs.items() if k != "figsize"}
|
|
80
|
+
fig, ax = BasePlot.create_fig(
|
|
81
|
+
figsize=kwargs.get("figsize", FIG_SIZE),
|
|
82
|
+
style=style,
|
|
83
|
+
)
|
|
84
|
+
self.aplot(*args, **{**plot_kwargs, "ax": ax, "style": style})
|
|
85
|
+
|
|
86
|
+
return fig
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def create_fig(
|
|
90
|
+
cls, figsize: Tuple[float, float], style: StyleTemplate
|
|
91
|
+
) -> Tuple[Figure, Axes]:
|
|
92
|
+
"""Create a figure and axis configured from the provided style.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
figsize : tuple[float, float]
|
|
97
|
+
Figure size in inches.
|
|
98
|
+
style : StyleTemplate
|
|
99
|
+
Style template used for figure and axes backgrounds.
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
tuple[Figure, Axes]
|
|
104
|
+
Created Matplotlib figure and a single subplot axes.
|
|
88
105
|
"""
|
|
106
|
+
fig_raw, ax_raw = plt.subplots(figsize=figsize)
|
|
107
|
+
fig = cast(Figure, fig_raw)
|
|
108
|
+
ax = cast(Axes, ax_raw)
|
|
109
|
+
fig.set_facecolor(style.background_color)
|
|
110
|
+
fig.set_edgecolor(style.background_color)
|
|
111
|
+
ax.set_facecolor(style.background_color)
|
|
112
|
+
return fig, ax
|
MatplotLibAPI/box_violin.py
CHANGED
|
@@ -4,7 +4,6 @@ from typing import Any, Optional, Tuple
|
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
import seaborn as sns
|
|
7
|
-
import matplotlib.pyplot as plt
|
|
8
7
|
from matplotlib.axes import Axes
|
|
9
8
|
from matplotlib.figure import Figure
|
|
10
9
|
|
|
@@ -51,7 +50,7 @@ class BoxViolinPlot(BasePlot):
|
|
|
51
50
|
def aplot(
|
|
52
51
|
self,
|
|
53
52
|
title: Optional[str] = None,
|
|
54
|
-
style: StyleTemplate =
|
|
53
|
+
style: Optional[StyleTemplate] = None,
|
|
55
54
|
ax: Optional[Axes] = None,
|
|
56
55
|
**kwargs: Any,
|
|
57
56
|
) -> Axes:
|
|
@@ -73,6 +72,8 @@ class BoxViolinPlot(BasePlot):
|
|
|
73
72
|
Axes
|
|
74
73
|
The Matplotlib axes containing the distribution chart.
|
|
75
74
|
"""
|
|
75
|
+
if not style:
|
|
76
|
+
style = DISTRIBUTION_STYLE_TEMPLATE
|
|
76
77
|
plot_ax = _get_axis(ax)
|
|
77
78
|
|
|
78
79
|
common_kwargs = {
|
|
@@ -103,42 +104,6 @@ class BoxViolinPlot(BasePlot):
|
|
|
103
104
|
plot_ax.set_title(title)
|
|
104
105
|
return plot_ax
|
|
105
106
|
|
|
106
|
-
def fplot(
|
|
107
|
-
self,
|
|
108
|
-
title: Optional[str] = None,
|
|
109
|
-
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
110
|
-
figsize: Tuple[float, float] = (10, 6),
|
|
111
|
-
) -> Figure:
|
|
112
|
-
"""Plot a box or violin chart on a new figure.
|
|
113
|
-
|
|
114
|
-
Parameters
|
|
115
|
-
----------
|
|
116
|
-
title : str, optional
|
|
117
|
-
Title for the plot. The default is None.
|
|
118
|
-
style : StyleTemplate, optional
|
|
119
|
-
Style template for the plot. The default is DISTRIBUTION_STYLE_TEMPLATE.
|
|
120
|
-
figsize : tuple[float, float], optional
|
|
121
|
-
Figure size. The default is (10, 6).
|
|
122
|
-
|
|
123
|
-
Returns
|
|
124
|
-
-------
|
|
125
|
-
Figure
|
|
126
|
-
The Matplotlib figure containing the distribution chart.
|
|
127
|
-
"""
|
|
128
|
-
fig = Figure(
|
|
129
|
-
figsize=figsize,
|
|
130
|
-
facecolor=style.background_color,
|
|
131
|
-
edgecolor=style.background_color,
|
|
132
|
-
)
|
|
133
|
-
ax = fig.add_subplot(111)
|
|
134
|
-
ax.set_facecolor(style.background_color)
|
|
135
|
-
self.aplot(
|
|
136
|
-
title=title,
|
|
137
|
-
style=style,
|
|
138
|
-
ax=ax,
|
|
139
|
-
)
|
|
140
|
-
return fig
|
|
141
|
-
|
|
142
107
|
|
|
143
108
|
def aplot_box_violin(
|
|
144
109
|
pd_df: pd.DataFrame,
|
MatplotLibAPI/bubble.py
CHANGED
|
@@ -330,7 +330,7 @@ class Bubble(BasePlot):
|
|
|
330
330
|
def aplot(
|
|
331
331
|
self,
|
|
332
332
|
title: Optional[str] = None,
|
|
333
|
-
style: StyleTemplate =
|
|
333
|
+
style: Optional[StyleTemplate] = None,
|
|
334
334
|
hline: bool = False,
|
|
335
335
|
vline: bool = False,
|
|
336
336
|
ax: Optional[Axes] = None,
|
|
@@ -397,6 +397,8 @@ class Bubble(BasePlot):
|
|
|
397
397
|
>>> Bubble.aplot(df, label='country', x='gdp_per_capita',
|
|
398
398
|
... y='life_expectancy', z='population', ax=ax)
|
|
399
399
|
"""
|
|
400
|
+
if not style:
|
|
401
|
+
style = BUBBLE_STYLE_TEMPLATE
|
|
400
402
|
if ax is None:
|
|
401
403
|
ax = cast(Axes, plt.gca())
|
|
402
404
|
|
|
@@ -420,150 +422,3 @@ class Bubble(BasePlot):
|
|
|
420
422
|
)
|
|
421
423
|
|
|
422
424
|
return ax
|
|
423
|
-
|
|
424
|
-
def fplot(
|
|
425
|
-
self,
|
|
426
|
-
title: Optional[str] = None,
|
|
427
|
-
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
428
|
-
hline: bool = False,
|
|
429
|
-
vline: bool = False,
|
|
430
|
-
figsize: Tuple[float, float] = FIG_SIZE,
|
|
431
|
-
) -> Figure:
|
|
432
|
-
"""Plot a bubble chart on a new figure.
|
|
433
|
-
|
|
434
|
-
Parameters
|
|
435
|
-
----------
|
|
436
|
-
pd_df : pd.DataFrame
|
|
437
|
-
DataFrame containing the data to plot.
|
|
438
|
-
label : str
|
|
439
|
-
Column name for bubble labels.
|
|
440
|
-
x : str
|
|
441
|
-
Column name for x-axis values.
|
|
442
|
-
y : str
|
|
443
|
-
Column name for y-axis values.
|
|
444
|
-
z : str
|
|
445
|
-
Column name for bubble sizes.
|
|
446
|
-
title : str, optional
|
|
447
|
-
Plot title. The default is None.
|
|
448
|
-
style : StyleTemplate, optional
|
|
449
|
-
Plot styling. The default is `BUBBLE_STYLE_TEMPLATE`.
|
|
450
|
-
max_values : int, optional
|
|
451
|
-
Max number of rows to display. The default is `MAX_RESULTS`.
|
|
452
|
-
center_to_mean : bool, optional
|
|
453
|
-
Whether to center x around its mean. The default is False.
|
|
454
|
-
sort_by : str, optional
|
|
455
|
-
Column to sort by. The default is None.
|
|
456
|
-
ascending : bool, optional
|
|
457
|
-
Sort order. The default is False.
|
|
458
|
-
hline : bool, optional
|
|
459
|
-
Draw horizontal line at mean y. The default is False.
|
|
460
|
-
vline : bool, optional
|
|
461
|
-
Draw vertical line at mean x. The default is False.
|
|
462
|
-
figsize : tuple[float, float], optional
|
|
463
|
-
Size of the figure. The default is FIG_SIZE.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
Returns
|
|
467
|
-
-------
|
|
468
|
-
Figure
|
|
469
|
-
A matplotlib Figure object with the bubble chart.
|
|
470
|
-
|
|
471
|
-
Raises
|
|
472
|
-
------
|
|
473
|
-
AttributeError
|
|
474
|
-
If required columns are not in the DataFrame.
|
|
475
|
-
|
|
476
|
-
Examples
|
|
477
|
-
--------
|
|
478
|
-
>>> import pandas as pd
|
|
479
|
-
>>> from MatplotLibAPI import Bubble
|
|
480
|
-
>>> data = {
|
|
481
|
-
... 'country': ['A', 'B', 'C', 'D'],
|
|
482
|
-
... 'gdp_per_capita': [45000, 42000, 52000, 48000],
|
|
483
|
-
... 'life_expectancy': [81, 78, 83, 82],
|
|
484
|
-
... 'population': [10, 20, 5, 30]
|
|
485
|
-
... }
|
|
486
|
-
>>> df = pd.DataFrame(data)
|
|
487
|
-
>>> fig = Bubble.fplot(df, label='country', x='gdp_per_capita',
|
|
488
|
-
... y='life_expectancy', z='population')
|
|
489
|
-
"""
|
|
490
|
-
fig = Figure(
|
|
491
|
-
figsize=figsize,
|
|
492
|
-
facecolor=style.background_color,
|
|
493
|
-
edgecolor=style.background_color,
|
|
494
|
-
)
|
|
495
|
-
ax = fig.add_subplot(111)
|
|
496
|
-
ax.set_facecolor(style.background_color)
|
|
497
|
-
|
|
498
|
-
self.aplot(
|
|
499
|
-
title=title,
|
|
500
|
-
style=style,
|
|
501
|
-
hline=hline,
|
|
502
|
-
vline=vline,
|
|
503
|
-
ax=ax,
|
|
504
|
-
)
|
|
505
|
-
return fig
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
def aplot_bubble(
|
|
509
|
-
pd_df: pd.DataFrame,
|
|
510
|
-
label: str,
|
|
511
|
-
x: str,
|
|
512
|
-
y: str,
|
|
513
|
-
z: str,
|
|
514
|
-
sort_by: Optional[str] = None,
|
|
515
|
-
ascending: bool = False,
|
|
516
|
-
max_values: int = MAX_RESULTS,
|
|
517
|
-
center_to_mean: bool = False,
|
|
518
|
-
title: Optional[str] = None,
|
|
519
|
-
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
520
|
-
hline: bool = False,
|
|
521
|
-
vline: bool = False,
|
|
522
|
-
ax: Optional[Axes] = None,
|
|
523
|
-
**kwargs: Any,
|
|
524
|
-
) -> Axes:
|
|
525
|
-
"""Plot a bubble chart on existing axes."""
|
|
526
|
-
return Bubble(
|
|
527
|
-
pd_df=pd_df,
|
|
528
|
-
label=label,
|
|
529
|
-
x=x,
|
|
530
|
-
y=y,
|
|
531
|
-
z=z,
|
|
532
|
-
sort_by=sort_by,
|
|
533
|
-
ascending=ascending,
|
|
534
|
-
max_values=max_values,
|
|
535
|
-
center_to_mean=center_to_mean,
|
|
536
|
-
).aplot(title=title, style=style, hline=hline, vline=vline, ax=ax, **kwargs)
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
def fplot_bubble(
|
|
540
|
-
pd_df: pd.DataFrame,
|
|
541
|
-
label: str,
|
|
542
|
-
x: str,
|
|
543
|
-
y: str,
|
|
544
|
-
z: str,
|
|
545
|
-
sort_by: Optional[str] = None,
|
|
546
|
-
ascending: bool = False,
|
|
547
|
-
max_values: int = MAX_RESULTS,
|
|
548
|
-
center_to_mean: bool = False,
|
|
549
|
-
title: Optional[str] = None,
|
|
550
|
-
style: StyleTemplate = BUBBLE_STYLE_TEMPLATE,
|
|
551
|
-
hline: bool = False,
|
|
552
|
-
vline: bool = False,
|
|
553
|
-
figsize: Tuple[float, float] = FIG_SIZE,
|
|
554
|
-
**kwargs: Any,
|
|
555
|
-
) -> Figure:
|
|
556
|
-
"""Plot a bubble chart on a new figure."""
|
|
557
|
-
return Bubble(
|
|
558
|
-
pd_df=pd_df,
|
|
559
|
-
label=label,
|
|
560
|
-
x=x,
|
|
561
|
-
y=y,
|
|
562
|
-
z=z,
|
|
563
|
-
sort_by=sort_by,
|
|
564
|
-
ascending=ascending,
|
|
565
|
-
max_values=max_values,
|
|
566
|
-
center_to_mean=center_to_mean,
|
|
567
|
-
).fplot(
|
|
568
|
-
title=title, style=style, hline=hline, vline=vline, figsize=figsize, **kwargs
|
|
569
|
-
)
|
MatplotLibAPI/composite.py
CHANGED
|
@@ -32,7 +32,7 @@ def plot_composite_bubble(
|
|
|
32
32
|
y: str,
|
|
33
33
|
z: str,
|
|
34
34
|
title: Optional[str] = None,
|
|
35
|
-
style: StyleTemplate =
|
|
35
|
+
style: Optional[StyleTemplate] = None,
|
|
36
36
|
max_values: int = 50,
|
|
37
37
|
center_to_mean: bool = False,
|
|
38
38
|
filter_by: Optional[str] = None,
|
|
@@ -80,7 +80,8 @@ def plot_composite_bubble(
|
|
|
80
80
|
Matplotlib figure containing the composite bubble chart and tables.
|
|
81
81
|
"""
|
|
82
82
|
validate_dataframe(pd_df, cols=[label, x, y, z], sort_by=sort_by)
|
|
83
|
-
|
|
83
|
+
if not style:
|
|
84
|
+
style = BUBBLE_STYLE_TEMPLATE
|
|
84
85
|
fig = cast(Figure, plt.figure(figsize=figsize))
|
|
85
86
|
fig.set_facecolor(style.background_color)
|
|
86
87
|
grid = GridSpec(2, 2, height_ratios=[2, 1], width_ratios=[1, 1])
|
|
@@ -133,7 +134,7 @@ def plot_composite_bubble(
|
|
|
133
134
|
def plot_composite_treemap(
|
|
134
135
|
pd_dfs: Dict[str, pd.DataFrame],
|
|
135
136
|
values: str,
|
|
136
|
-
style: StyleTemplate =
|
|
137
|
+
style: Optional[StyleTemplate] = None,
|
|
137
138
|
title: Optional[str] = None,
|
|
138
139
|
color: Optional[str] = None,
|
|
139
140
|
sort_by: Optional[str] = None,
|
|
@@ -205,7 +206,7 @@ def fplot_wordcloud_network(
|
|
|
205
206
|
max_words: int = MAX_RESULTS,
|
|
206
207
|
stopwords: Optional[Iterable[str]] = None,
|
|
207
208
|
title: Optional[str] = None,
|
|
208
|
-
style: StyleTemplate =
|
|
209
|
+
style: Optional[StyleTemplate] = None,
|
|
209
210
|
wordcloud_style: Optional[StyleTemplate] = None,
|
|
210
211
|
network_style: Optional[StyleTemplate] = None,
|
|
211
212
|
figsize: Tuple[float, float] = FIG_SIZE,
|
|
@@ -246,6 +247,8 @@ def fplot_wordcloud_network(
|
|
|
246
247
|
Figure
|
|
247
248
|
Matplotlib figure containing the word cloud on top and network below.
|
|
248
249
|
"""
|
|
250
|
+
if not style:
|
|
251
|
+
style = WORDCLOUD_STYLE_TEMPLATE
|
|
249
252
|
fig_raw, axes_raw = plt.subplots(
|
|
250
253
|
2,
|
|
251
254
|
1,
|