MatplotLibAPI 4.0.2__tar.gz → 4.0.4__tar.gz

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.
Files changed (75) hide show
  1. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/.github/workflows/ci.yml +4 -1
  2. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/PKG-INFO +2 -2
  3. matplotlibapi-4.0.4/examples/bubble.py +42 -0
  4. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/examples/network.py +6 -9
  5. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/examples/sample_data.py +6 -15
  6. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/pyproject.toml +2 -2
  7. matplotlibapi-4.0.4/src/MatplotLibAPI/__init__.py +6 -0
  8. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/accessor.py +107 -168
  9. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/area.py +3 -4
  10. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/bar.py +3 -4
  11. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/base_plot.py +60 -3
  12. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/box_violin.py +2 -3
  13. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/bubble.py +80 -13
  14. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/composite.py +233 -16
  15. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/heatmap.py +7 -10
  16. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/histogram.py +2 -6
  17. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/network/constants.py +1 -0
  18. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/network/core.py +27 -2
  19. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/network/plot.py +2 -0
  20. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/pie.py +2 -3
  21. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/pivot.py +9 -11
  22. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/table.py +1 -3
  23. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/timeserie.py +2 -2
  24. matplotlibapi-4.0.4/src/MatplotLibAPI/types.py +6 -0
  25. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/waffle.py +1 -3
  26. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/word_cloud.py +1 -3
  27. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_network.py +60 -0
  28. matplotlibapi-4.0.2/examples/network.png +0 -0
  29. matplotlibapi-4.0.2/src/MatplotLibAPI/__init__.py +0 -7
  30. matplotlibapi-4.0.2/src/MatplotLibAPI/typing.py +0 -9
  31. matplotlibapi-4.0.2/src/MatplotLibAPI/utils.py +0 -111
  32. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/.github/dependabot.yml +0 -0
  33. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/.github/workflows/python-publish.yml +0 -0
  34. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/.gitignore +0 -0
  35. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/.pre-commit-config.yaml +0 -0
  36. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/AGENTS.md +0 -0
  37. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/LICENSE +0 -0
  38. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/README.md +0 -0
  39. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/SECURITY.md +0 -0
  40. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/SUGGESTIONS.md +0 -0
  41. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/examples/__init__.py +0 -0
  42. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/scripts/pre_commit.sh +0 -0
  43. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/mcp/__init__.py +0 -0
  44. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/mcp/metadata.py +0 -0
  45. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/mcp/renderers.py +0 -0
  46. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/mcp_server.py +0 -0
  47. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/network/__init__.py +0 -0
  48. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/network/scaling.py +0 -0
  49. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/sankey.py +0 -0
  50. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/style_template.py +0 -0
  51. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/sunburst.py +0 -0
  52. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/src/MatplotLibAPI/treemap.py +0 -0
  53. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/__init__.py +0 -0
  54. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/conftest.py +0 -0
  55. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_area.py +0 -0
  56. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_bar.py +0 -0
  57. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_box_violin.py +0 -0
  58. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_bubble.py +0 -0
  59. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_composite.py +0 -0
  60. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_dependencies.py +0 -0
  61. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_heatmap.py +0 -0
  62. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_histogram.py +0 -0
  63. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_mcp_server.py +0 -0
  64. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_network_preprocessing.py +0 -0
  65. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_pie.py +0 -0
  66. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_pivot.py +0 -0
  67. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_sankey.py +0 -0
  68. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_smoke.py +0 -0
  69. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_style_template.py +0 -0
  70. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_sunburst.py +0 -0
  71. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_table.py +0 -0
  72. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_timeseries.py +0 -0
  73. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_treemap.py +0 -0
  74. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_waffle.py +0 -0
  75. {matplotlibapi-4.0.2 → matplotlibapi-4.0.4}/tests/test_wordcloud.py +0 -0
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v4
@@ -44,3 +44,6 @@ jobs:
44
44
 
45
45
  - name: Type check with pyright
46
46
  run: pyright src
47
+
48
+ - name: Run tests with coverage
49
+ run: pytest -q --cov=src --cov-report=term-missing --cov-fail-under=70
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MatplotLibAPI
3
- Version: 4.0.2
3
+ Version: 4.0.4
4
4
  License-File: LICENSE
5
- Requires-Python: >=3.8
5
+ Requires-Python: >=3.9
6
6
  Requires-Dist: kaleido
7
7
  Requires-Dist: matplotlib
8
8
  Requires-Dist: nbformat
@@ -0,0 +1,42 @@
1
+ """
2
+ Example module for network graph sample data generation and plotting.
3
+
4
+ This module provides functions to generate and plot sample network data for testing.
5
+ """
6
+
7
+ import sys
8
+ from pathlib import Path
9
+ from matplotlib.figure import Figure
10
+ import pandas as pd
11
+
12
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
13
+ from MatplotLibAPI.bubble import Bubble
14
+
15
+
16
+ def generate_sample_data() -> pd.DataFrame:
17
+ """Generate and save sample data for a bubble chart."""
18
+ data = {
19
+ "country": ["USA", "China", "India", "Brazil", "Nigeria"],
20
+ "population": [331, 1441, 1393, 213, 206], # in millions
21
+ "gdp_per_capita": [63593, 10500, 2191, 7741, 2229],
22
+ "age": [62, 45, 35, 42, 30],
23
+ }
24
+ df = pd.DataFrame(data)
25
+ return df
26
+
27
+
28
+ def plot_sample_data() -> Figure:
29
+ """Load a sample DataFrame for testing."""
30
+
31
+ pd_df = generate_sample_data()
32
+ o_plot = Bubble(
33
+ pd_df=pd_df, label="country", x="population", y="gdp_per_capita", z="age"
34
+ )
35
+ plot_fig = o_plot.fplot(title="Bubble Graph")
36
+
37
+ return plot_fig
38
+
39
+
40
+ if __name__ == "__main__":
41
+ plot_fig = plot_sample_data()
42
+ plot_fig.show()
@@ -13,7 +13,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
13
13
  from MatplotLibAPI.network import NetworkGraph
14
14
 
15
15
 
16
- def generate_sample_network_data() -> pd.DataFrame:
16
+ def generate_sample_data() -> pd.DataFrame:
17
17
  """Generate and save sample data for a network graph."""
18
18
  data = {
19
19
  "city_a": ["New York", "London", "Tokyo", "Sydney", "New York"],
@@ -24,21 +24,18 @@ def generate_sample_network_data() -> pd.DataFrame:
24
24
  return df
25
25
 
26
26
 
27
- def plot_sample_network_data() -> Figure:
27
+ def plot_sample_data() -> Figure:
28
28
  """Load a sample DataFrame for testing."""
29
29
 
30
- pd_df = generate_sample_network_data()
30
+ pd_df = generate_sample_data()
31
31
  graph = NetworkGraph.from_pandas_edgelist(
32
32
  pd_df, source="city_a", target="city_b", edge_weight_col="distance_km"
33
33
  )
34
- plot_fig = graph.fplot_w(title="Network Graph")
34
+ plot_fig = graph.fplot(title="Network Graph")
35
35
 
36
36
  return plot_fig
37
37
 
38
38
 
39
39
  if __name__ == "__main__":
40
- plot_df = generate_sample_network_data()
41
- f = plot_df.mpl.fplot_network(
42
- source="city_a", target="city_b", edge_weight_col="distance_km"
43
- )
44
- plot_fig = plot_sample_network_data()
40
+ plot_fig = plot_sample_data()
41
+ plot_fig.show()
@@ -6,25 +6,16 @@ import pandas as pd
6
6
 
7
7
  def generate_bubble_data():
8
8
  """Generate and save sample data for a bubble chart."""
9
- data = {
10
- "country": ["USA", "China", "India", "Brazil", "Nigeria"],
11
- "population": [331, 1441, 1393, 213, 206], # in millions
12
- "gdp_per_capita": [63593, 10500, 2191, 7741, 2229],
13
- "continent": ["North America", "Asia", "Asia", "South America", "Africa"],
14
- }
15
- df = pd.DataFrame(data)
16
- df.to_csv("data/bubble.csv", index=False)
9
+ from .bubble import generate_sample_data
10
+
11
+ generate_sample_data().to_csv("data/bubble.csv", index=False)
17
12
 
18
13
 
19
14
  def generate_network_data():
20
15
  """Generate and save sample data for a network graph."""
21
- data = {
22
- "city_a": ["New York", "London", "Tokyo", "Sydney", "New York"],
23
- "city_b": ["London", "Tokyo", "Sydney", "New York", "Tokyo"],
24
- "distance_km": [5585, 9562, 7824, 16027, 10850],
25
- }
26
- df = pd.DataFrame(data)
27
- df.to_csv("data/network.csv", index=False)
16
+ from .network import generate_sample_data
17
+
18
+ generate_sample_data().to_csv("data/network.csv", index=False)
28
19
 
29
20
 
30
21
  def generate_pivot_data():
@@ -3,9 +3,9 @@ requires = ["hatchling"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "MatplotLibAPI"
6
- version = "4.0.2"
6
+ version = "4.0.4"
7
7
  readme = "README.md"
8
- requires-python = ">=3.8"
8
+ requires-python = ">=3.9"
9
9
  dependencies = [
10
10
  "pandas",
11
11
  "matplotlib",
@@ -0,0 +1,6 @@
1
+ """Public API and pandas accessor for MatplotLibAPI."""
2
+
3
+ from .accessor import DataFrameAccessor
4
+ from .types import CorrelationMethod
5
+
6
+ __all__ = ["DataFrameAccessor", "CorrelationMethod"]
@@ -10,7 +10,6 @@ from matplotlib.axes import Axes
10
10
  from matplotlib.figure import Figure
11
11
  from pandas.api.extensions import register_dataframe_accessor
12
12
 
13
- from .base_plot import BasePlot
14
13
  from .style_template import (
15
14
  FIG_SIZE,
16
15
  AREA_STYLE_TEMPLATE,
@@ -21,148 +20,13 @@ from .style_template import (
21
20
  TREEMAP_STYLE_TEMPLATE,
22
21
  StyleTemplate,
23
22
  )
24
- from .typing import CorrelationMethod
23
+
24
+ from .types import CorrelationMethod
25
25
 
26
26
  if TYPE_CHECKING:
27
27
  import plotly.graph_objects as go
28
28
 
29
29
 
30
- def _heatmap_imports() -> tuple[StyleTemplate, Any, Any, Any, Any]:
31
- from .heatmap import (
32
- HEATMAP_STYLE_TEMPLATE,
33
- aplot_correlation_matrix,
34
- aplot_heatmap,
35
- fplot_correlation_matrix,
36
- fplot_heatmap,
37
- )
38
-
39
- return (
40
- HEATMAP_STYLE_TEMPLATE,
41
- aplot_correlation_matrix,
42
- aplot_heatmap,
43
- fplot_correlation_matrix,
44
- fplot_heatmap,
45
- )
46
-
47
-
48
- def _network_imports() -> tuple[StyleTemplate, Any, Any, Any, Any, Any, Any]:
49
- from .network import (
50
- NETWORK_STYLE_TEMPLATE,
51
- aplot_network,
52
- aplot_network_node,
53
- aplot_network_components,
54
- fplot_network,
55
- fplot_network_node,
56
- fplot_network_components,
57
- )
58
-
59
- return (
60
- NETWORK_STYLE_TEMPLATE,
61
- aplot_network,
62
- aplot_network_node,
63
- aplot_network_components,
64
- fplot_network,
65
- fplot_network_node,
66
- fplot_network_components,
67
- )
68
-
69
-
70
- def _wordcloud_imports() -> tuple[StyleTemplate, Any, Any]:
71
- from .word_cloud import WORDCLOUD_STYLE_TEMPLATE, aplot_wordcloud, fplot_wordcloud
72
-
73
- return WORDCLOUD_STYLE_TEMPLATE, aplot_wordcloud, fplot_wordcloud
74
-
75
-
76
- def _sankey_imports() -> tuple[StyleTemplate, Any]:
77
- from .sankey import SANKEY_STYLE_TEMPLATE, fplot_sankey
78
-
79
- return SANKEY_STYLE_TEMPLATE, fplot_sankey
80
-
81
-
82
- def aplot_histogram(*args: Any, **kwargs: Any) -> Axes:
83
- from .histogram import aplot_histogram as _aplot_histogram
84
-
85
- return _aplot_histogram(*args, **kwargs)
86
-
87
-
88
- def fplot_histogram(*args: Any, **kwargs: Any) -> Figure:
89
- from .histogram import fplot_histogram as _fplot_histogram
90
-
91
- return _fplot_histogram(*args, **kwargs)
92
-
93
-
94
- def aplot_pie_donut(*args: Any, **kwargs: Any) -> Axes:
95
- from .pie import aplot_pie as _aplot_pie_donut
96
-
97
- return _aplot_pie_donut(*args, **kwargs)
98
-
99
-
100
- def fplot_pie_donut(*args: Any, **kwargs: Any) -> Figure:
101
- from .pie import fplot_pie as _fplot_pie_donut
102
-
103
- return _fplot_pie_donut(*args, **kwargs)
104
-
105
-
106
- def aplot_table(*args: Any, **kwargs: Any) -> Axes:
107
- from .table import aplot_table as _aplot_table
108
-
109
- return _aplot_table(*args, **kwargs)
110
-
111
-
112
- def fplot_table(*args: Any, **kwargs: Any) -> Figure:
113
- from .table import fplot_table as _fplot_table
114
-
115
- return _fplot_table(*args, **kwargs)
116
-
117
-
118
- def aplot_timeserie(*args: Any, **kwargs: Any) -> Axes:
119
- from .timeserie import aplot_timeserie as _aplot_timeserie
120
-
121
- return _aplot_timeserie(*args, **kwargs)
122
-
123
-
124
- def fplot_timeserie(*args: Any, **kwargs: Any) -> Figure:
125
- from .timeserie import fplot_timeserie as _fplot_timeserie
126
-
127
- return _fplot_timeserie(*args, **kwargs)
128
-
129
-
130
- def aplot_waffle(*args: Any, **kwargs: Any) -> Axes:
131
- from .waffle import aplot_waffle as _aplot_waffle
132
-
133
- return _aplot_waffle(*args, **kwargs)
134
-
135
-
136
- def fplot_waffle(*args: Any, **kwargs: Any) -> Figure:
137
- from .waffle import fplot_waffle as _fplot_waffle
138
-
139
- return _fplot_waffle(*args, **kwargs)
140
-
141
-
142
- def fplot_treemap(*args: Any, **kwargs: Any) -> go.Figure:
143
- from .treemap import fplot_treemap as _fplot_treemap
144
-
145
- return _fplot_treemap(*args, **kwargs)
146
-
147
-
148
- def fplot_sunburst(*args: Any, **kwargs: Any) -> go.Figure:
149
- from .sunburst import fplot_sunburst as _fplot_sunburst
150
-
151
- return _fplot_sunburst(*args, **kwargs)
152
-
153
-
154
- def plot_composite_bubble(*args: Any, **kwargs: Any) -> Figure:
155
- from .composite import plot_composite_bubble as _plot_composite_bubble
156
-
157
- return _plot_composite_bubble(*args, **kwargs)
158
-
159
-
160
- def plot_composite_treemap(*args: Any, **kwargs: Any) -> Optional[go.Figure]:
161
- from .composite import plot_composite_treemap as _plot_composite_treemap
162
-
163
- return _plot_composite_treemap(*args, **kwargs)
164
-
165
-
166
30
  @register_dataframe_accessor("mpl")
167
31
  class DataFrameAccessor:
168
32
  """Expose MatplotLibAPI plotting helpers as a pandas accessor.
@@ -490,7 +354,9 @@ class DataFrameAccessor:
490
354
  Axes
491
355
  The Matplotlib axes object with the histogram.
492
356
  """
493
- return aplot_histogram(
357
+ from .histogram import aplot_histogram as _aplot_histogram
358
+
359
+ return _aplot_histogram(
494
360
  pd_df=self._obj,
495
361
  column=column,
496
362
  bins=bins,
@@ -531,7 +397,9 @@ class DataFrameAccessor:
531
397
  Figure
532
398
  The new Matplotlib figure with the histogram.
533
399
  """
534
- return fplot_histogram(
400
+ from .histogram import fplot_histogram as _fplot_histogram
401
+
402
+ return _fplot_histogram(
535
403
  pd_df=self._obj,
536
404
  column=column,
537
405
  bins=bins,
@@ -844,7 +712,9 @@ class DataFrameAccessor:
844
712
  Axes
845
713
  The Matplotlib axes object with the pie or donut chart.
846
714
  """
847
- return aplot_pie_donut(
715
+ from .pie import aplot_pie as _aplot_pie_donut
716
+
717
+ return _aplot_pie_donut(
848
718
  pd_df=self._obj,
849
719
  category=category,
850
720
  value=value,
@@ -885,7 +755,9 @@ class DataFrameAccessor:
885
755
  Figure
886
756
  The new Matplotlib figure with the pie or donut chart.
887
757
  """
888
- return fplot_pie_donut(
758
+ from .pie import fplot_pie as _fplot_pie_donut
759
+
760
+ return _fplot_pie_donut(
889
761
  pd_df=self._obj,
890
762
  category=category,
891
763
  value=value,
@@ -926,7 +798,9 @@ class DataFrameAccessor:
926
798
  Axes
927
799
  The Matplotlib axes object with the waffle chart.
928
800
  """
929
- return aplot_waffle(
801
+ from .waffle import aplot_waffle as _aplot_waffle
802
+
803
+ return _aplot_waffle(
930
804
  pd_df=self._obj,
931
805
  category=category,
932
806
  value=value,
@@ -967,7 +841,9 @@ class DataFrameAccessor:
967
841
  Figure
968
842
  The new Matplotlib figure with the waffle chart.
969
843
  """
970
- return fplot_waffle(
844
+ from .waffle import fplot_waffle as _fplot_waffle
845
+
846
+ return _fplot_waffle(
971
847
  pd_df=self._obj,
972
848
  category=category,
973
849
  value=value,
@@ -1005,7 +881,7 @@ class DataFrameAccessor:
1005
881
  go.Figure
1006
882
  The Plotly Sankey figure.
1007
883
  """
1008
- sankey_style_template, fplot_sankey = _sankey_imports()
884
+ from .sankey import SANKEY_STYLE_TEMPLATE, fplot_sankey
1009
885
 
1010
886
  return fplot_sankey(
1011
887
  pd_df=self._obj,
@@ -1013,7 +889,7 @@ class DataFrameAccessor:
1013
889
  target=target,
1014
890
  value=value,
1015
891
  title=title,
1016
- style=style or sankey_style_template,
892
+ style=style or SANKEY_STYLE_TEMPLATE,
1017
893
  )
1018
894
 
1019
895
  def aplot_table(
@@ -1050,7 +926,9 @@ class DataFrameAccessor:
1050
926
  Axes
1051
927
  The Matplotlib axes object with the plot.
1052
928
  """
1053
- return aplot_table(
929
+ from .table import aplot_table as _aplot_table
930
+
931
+ return _aplot_table(
1054
932
  pd_df=self._obj,
1055
933
  cols=cols,
1056
934
  title=title,
@@ -1095,7 +973,9 @@ class DataFrameAccessor:
1095
973
  Figure
1096
974
  The new Matplotlib figure with the table.
1097
975
  """
1098
- return fplot_table(
976
+ from .table import fplot_table as _fplot_table
977
+
978
+ return _fplot_table(
1099
979
  pd_df=self._obj,
1100
980
  cols=cols,
1101
981
  title=title,
@@ -1149,7 +1029,9 @@ class DataFrameAccessor:
1149
1029
  Axes
1150
1030
  The Matplotlib axes object with the plot.
1151
1031
  """
1152
- return aplot_timeserie(
1032
+ from .timeserie import aplot_timeserie as _aplot_timeserie
1033
+
1034
+ return _aplot_timeserie(
1153
1035
  pd_df=self._obj,
1154
1036
  label=label,
1155
1037
  x=x,
@@ -1206,7 +1088,9 @@ class DataFrameAccessor:
1206
1088
  Figure
1207
1089
  The new Matplotlib figure with the plot.
1208
1090
  """
1209
- return fplot_timeserie(
1091
+ from .timeserie import fplot_timeserie as _fplot_timeserie
1092
+
1093
+ return _fplot_timeserie(
1210
1094
  pd_df=self._obj,
1211
1095
  label=label,
1212
1096
  x=x,
@@ -1257,14 +1141,14 @@ class DataFrameAccessor:
1257
1141
  Axes
1258
1142
  The Matplotlib axes object with the plot.
1259
1143
  """
1260
- wordcloud_style_template, aplot_wordcloud, _ = _wordcloud_imports()
1144
+ from .word_cloud import WORDCLOUD_STYLE_TEMPLATE, aplot_wordcloud
1261
1145
 
1262
1146
  return aplot_wordcloud(
1263
1147
  pd_df=self._obj,
1264
1148
  text_column=text_column,
1265
1149
  weight_column=weight_column,
1266
1150
  title=title,
1267
- style=style or wordcloud_style_template,
1151
+ style=style or WORDCLOUD_STYLE_TEMPLATE,
1268
1152
  max_words=max_words,
1269
1153
  stopwords=stopwords,
1270
1154
  random_state=random_state,
@@ -1308,14 +1192,14 @@ class DataFrameAccessor:
1308
1192
  Figure
1309
1193
  The new Matplotlib figure with the plot.
1310
1194
  """
1311
- wordcloud_style_template, _, fplot_wordcloud = _wordcloud_imports()
1195
+ from .word_cloud import WORDCLOUD_STYLE_TEMPLATE, fplot_wordcloud
1312
1196
 
1313
1197
  return fplot_wordcloud(
1314
1198
  pd_df=self._obj,
1315
1199
  text_column=text_column,
1316
1200
  weight_column=weight_column,
1317
1201
  title=title,
1318
- style=style or wordcloud_style_template,
1202
+ style=style or WORDCLOUD_STYLE_TEMPLATE,
1319
1203
  max_words=max_words,
1320
1204
  stopwords=stopwords,
1321
1205
  random_state=random_state,
@@ -1377,21 +1261,74 @@ class DataFrameAccessor:
1377
1261
  kwargs: Dict[str, Any] = {}
1378
1262
  if layout_seed is not None:
1379
1263
  kwargs["layout_seed"] = layout_seed
1264
+ from .network import (
1265
+ NETWORK_STYLE_TEMPLATE,
1266
+ aplot_network_node as _aplot_network_node,
1267
+ )
1380
1268
 
1381
- network_style_template, _, aplot_network_node, _, _, _, _ = _network_imports()
1382
-
1383
- return aplot_network_node(
1269
+ return _aplot_network_node(
1384
1270
  pd_df=self._obj,
1385
1271
  node=node,
1386
1272
  edge_source_col=edge_source_col,
1387
1273
  edge_target_col=edge_target_col,
1388
1274
  edge_weight_col=edge_weight_col,
1389
1275
  title=title,
1390
- style=style or network_style_template,
1276
+ style=style or NETWORK_STYLE_TEMPLATE,
1391
1277
  ax=ax,
1392
1278
  **kwargs,
1393
1279
  )
1394
1280
 
1281
+ def fplot_network(
1282
+ self,
1283
+ edge_source_col: str = "source",
1284
+ edge_target_col: str = "target",
1285
+ edge_weight_col: str = "weight",
1286
+ title: Optional[str] = None,
1287
+ style: Optional[StyleTemplate] = None,
1288
+ layout_seed: Optional[int] = None,
1289
+ figsize: Tuple[float, float] = FIG_SIZE,
1290
+ ) -> Figure:
1291
+ """Plot a network graph on a new figure.
1292
+
1293
+ Parameters
1294
+ ----------
1295
+ edge_source_col : str, optional
1296
+ Column for source nodes. The default is "source".
1297
+ edge_target_col : str, optional
1298
+ Column for target nodes. The default is "target".
1299
+ edge_weight_col : str, optional
1300
+ Column for edge weights. The default is "weight".
1301
+ title : str, optional
1302
+ Chart title.
1303
+ style : StyleTemplate, optional
1304
+ Styling template. The default is `NETWORK_STYLE_TEMPLATE`.
1305
+ layout_seed : int, optional
1306
+ Seed forwarded to the spring layout. The default is ``_DEFAULT["SPRING_LAYOUT_SEED"]``.
1307
+ figsize : tuple[float, float], optional
1308
+ Figure size. The default is FIG_SIZE.
1309
+
1310
+ Returns
1311
+ -------
1312
+ Figure
1313
+ The new Matplotlib figure with the plot.
1314
+ """
1315
+ kwargs: Dict[str, Any] = {}
1316
+ if layout_seed is not None:
1317
+ kwargs["layout_seed"] = layout_seed
1318
+
1319
+ from .network import NETWORK_STYLE_TEMPLATE, fplot_network
1320
+
1321
+ return fplot_network(
1322
+ pd_df=self._obj,
1323
+ edge_source_col=edge_source_col,
1324
+ edge_target_col=edge_target_col,
1325
+ edge_weight_col=edge_weight_col,
1326
+ title=title,
1327
+ style=style or NETWORK_STYLE_TEMPLATE,
1328
+ figsize=figsize,
1329
+ **kwargs,
1330
+ )
1331
+
1395
1332
  def aplot_network_components(
1396
1333
  self,
1397
1334
  edge_source_col: str = "source",
@@ -1437,9 +1374,7 @@ class DataFrameAccessor:
1437
1374
  if layout_seed is not None:
1438
1375
  kwargs["layout_seed"] = layout_seed
1439
1376
 
1440
- network_style_template, _, _, aplot_network_components, _, _, _ = (
1441
- _network_imports()
1442
- )
1377
+ from .network import NETWORK_STYLE_TEMPLATE, aplot_network_components
1443
1378
 
1444
1379
  aplot_network_components(
1445
1380
  pd_df=self._obj,
@@ -1449,7 +1384,7 @@ class DataFrameAccessor:
1449
1384
  sort_by=sort_by,
1450
1385
  ascending=ascending,
1451
1386
  title=title,
1452
- style=style or network_style_template,
1387
+ style=style or NETWORK_STYLE_TEMPLATE,
1453
1388
  axes=axes,
1454
1389
  **kwargs,
1455
1390
  )
@@ -1510,7 +1445,7 @@ class DataFrameAccessor:
1510
1445
  if layout_seed is not None:
1511
1446
  kwargs["layout_seed"] = layout_seed
1512
1447
 
1513
- network_style_template, _, _, _, _, fplot_network_node, _ = _network_imports()
1448
+ from .network import NETWORK_STYLE_TEMPLATE, fplot_network_node
1514
1449
 
1515
1450
  return fplot_network_node(
1516
1451
  pd_df=self._obj,
@@ -1519,7 +1454,7 @@ class DataFrameAccessor:
1519
1454
  edge_target_col=edge_target_col,
1520
1455
  edge_weight_col=edge_weight_col,
1521
1456
  title=title,
1522
- style=style or network_style_template,
1457
+ style=style or NETWORK_STYLE_TEMPLATE,
1523
1458
  figsize=figsize,
1524
1459
  **kwargs,
1525
1460
  )
@@ -1575,9 +1510,7 @@ class DataFrameAccessor:
1575
1510
  if layout_seed is not None:
1576
1511
  kwargs["layout_seed"] = layout_seed
1577
1512
 
1578
- network_style_template, _, _, _, _, _, fplot_network_components = (
1579
- _network_imports()
1580
- )
1513
+ from .network import NETWORK_STYLE_TEMPLATE, fplot_network_components
1581
1514
 
1582
1515
  return fplot_network_components(
1583
1516
  pd_df=self._obj,
@@ -1585,7 +1518,7 @@ class DataFrameAccessor:
1585
1518
  edge_target_col=edge_target_col,
1586
1519
  edge_weight_col=edge_weight_col,
1587
1520
  title=title,
1588
- style=style or network_style_template,
1521
+ style=style or NETWORK_STYLE_TEMPLATE,
1589
1522
  figsize=figsize,
1590
1523
  n_cols=n_cols,
1591
1524
  **kwargs,
@@ -1631,6 +1564,8 @@ class DataFrameAccessor:
1631
1564
  go.Figure
1632
1565
  The Plotly figure with the treemap.
1633
1566
  """
1567
+ from .treemap import fplot_treemap
1568
+
1634
1569
  return fplot_treemap(
1635
1570
  pd_df=self._obj,
1636
1571
  path=path,
@@ -1680,6 +1615,8 @@ class DataFrameAccessor:
1680
1615
  go.Figure
1681
1616
  The Plotly figure with the sunburst chart.
1682
1617
  """
1618
+ from .sunburst import fplot_sunburst
1619
+
1683
1620
  return fplot_sunburst(
1684
1621
  pd_df=self._obj,
1685
1622
  labels=labels,
@@ -1729,6 +1666,8 @@ class DataFrameAccessor:
1729
1666
  go.Figure, optional
1730
1667
  The Plotly figure with the composite treemap, or None if the input data is empty.
1731
1668
  """
1669
+ from .composite import plot_composite_treemap
1670
+
1732
1671
  pd_dfs: Dict[str, pd.DataFrame] = {}
1733
1672
  for path in paths:
1734
1673
  pd_dfs[path] = self._obj
@@ -14,7 +14,6 @@ from .style_template import (
14
14
  string_formatter,
15
15
  validate_dataframe,
16
16
  )
17
- from .utils import _get_axis, _merge_kwargs, create_fig
18
17
 
19
18
  __all__ = ["AREA_STYLE_TEMPLATE", "aplot_area", "fplot_area"]
20
19
 
@@ -83,7 +82,7 @@ class AreaChart(BasePlot):
83
82
  "alpha": 0.7,
84
83
  "ax": plot_ax,
85
84
  }
86
- pivot_df.plot(**_merge_kwargs(plot_kwargs, kwargs))
85
+ pivot_df.plot(**BasePlot.merge_kwargs(plot_kwargs, kwargs))
87
86
 
88
87
  legend = plot_ax.get_legend()
89
88
  if legend is not None:
@@ -101,7 +100,7 @@ class AreaChart(BasePlot):
101
100
  "color": style.font_color,
102
101
  "alpha": 0.4,
103
102
  }
104
- merged_fill_between_kwargs = _merge_kwargs(fill_between_kwargs, kwargs)
103
+ merged_fill_between_kwargs = BasePlot.merge_kwargs(fill_between_kwargs, kwargs)
105
104
 
106
105
  plot_ax.fill_between(
107
106
  sorted_df[self.x],
@@ -137,7 +136,7 @@ class AreaChart(BasePlot):
137
136
  """
138
137
  if not style:
139
138
  style = AREA_STYLE_TEMPLATE
140
- plot_ax = _get_axis(ax)
139
+ plot_ax = BasePlot.get_axis(ax)
141
140
  plot_ax.set_facecolor(style.background_color)
142
141
 
143
142
  if self.label: