MatplotLibAPI 3.2.13__tar.gz → 3.2.15__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.
- matplotlibapi-3.2.15/.github/workflows/ci.yml +43 -0
- matplotlibapi-3.2.15/.github/workflows/python-publish.yml +39 -0
- matplotlibapi-3.2.15/.gitignore +19 -0
- matplotlibapi-3.2.15/AGENTS.md +81 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Area.py +76 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Bar.py +79 -0
- matplotlibapi-3.2.15/MatplotLibAPI/BoxViolin.py +69 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Bubble.py +453 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Composite.py +195 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Heatmap.py +113 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Histogram.py +69 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Network.py +948 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Pie.py +66 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Pivot.py +134 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Sankey.py +39 -0
- matplotlibapi-3.2.15/MatplotLibAPI/StyleTemplate.py +314 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Sunburst.py +83 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Table.py +220 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Timeserie.py +342 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Treemap.py +165 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Waffle.py +82 -0
- matplotlibapi-3.2.15/MatplotLibAPI/Wordcloud.py +314 -0
- matplotlibapi-3.2.15/MatplotLibAPI/__init__.py +76 -0
- matplotlibapi-3.2.15/MatplotLibAPI/_visualization_utils.py +38 -0
- matplotlibapi-3.2.15/MatplotLibAPI/accessor.py +1647 -0
- matplotlibapi-3.2.15/PKG-INFO +269 -0
- matplotlibapi-3.2.15/README.md +245 -0
- matplotlibapi-3.2.15/SECURITY.md +21 -0
- matplotlibapi-3.2.15/SUGGESTIONS.md +7 -0
- matplotlibapi-3.2.15/pyproject.toml +33 -0
- matplotlibapi-3.2.15/scripts/generate_sample_data.py +338 -0
- matplotlibapi-3.2.15/tests/__init__.py +0 -0
- matplotlibapi-3.2.15/tests/conftest.py +48 -0
- matplotlibapi-3.2.15/tests/test_area.py +17 -0
- matplotlibapi-3.2.15/tests/test_bar.py +17 -0
- matplotlibapi-3.2.15/tests/test_box_violin.py +17 -0
- matplotlibapi-3.2.15/tests/test_bubble.py +22 -0
- matplotlibapi-3.2.15/tests/test_dependencies.py +33 -0
- matplotlibapi-3.2.15/tests/test_heatmap.py +25 -0
- matplotlibapi-3.2.15/tests/test_histogram.py +17 -0
- matplotlibapi-3.2.15/tests/test_network.py +17 -0
- matplotlibapi-3.2.15/tests/test_pie.py +15 -0
- matplotlibapi-3.2.15/tests/test_pivot.py +15 -0
- matplotlibapi-3.2.15/tests/test_sankey.py +15 -0
- matplotlibapi-3.2.15/tests/test_smoke.py +67 -0
- matplotlibapi-3.2.15/tests/test_sunburst.py +15 -0
- matplotlibapi-3.2.15/tests/test_table.py +15 -0
- matplotlibapi-3.2.15/tests/test_timeseries.py +15 -0
- matplotlibapi-3.2.15/tests/test_treemap.py +30 -0
- matplotlibapi-3.2.15/tests/test_waffle.py +15 -0
- matplotlibapi-3.2.15/tests/test_wordcloud.py +17 -0
- matplotlibapi-3.2.13/MatplotLibAPI/Bubble.py +0 -176
- matplotlibapi-3.2.13/MatplotLibAPI/Composite.py +0 -196
- matplotlibapi-3.2.13/MatplotLibAPI/Network.py +0 -468
- matplotlibapi-3.2.13/MatplotLibAPI/Pivot.py +0 -213
- matplotlibapi-3.2.13/MatplotLibAPI/StyleTemplate.py +0 -368
- matplotlibapi-3.2.13/MatplotLibAPI/Table.py +0 -91
- matplotlibapi-3.2.13/MatplotLibAPI/Timeserie.py +0 -128
- matplotlibapi-3.2.13/MatplotLibAPI/Treemap.py +0 -107
- matplotlibapi-3.2.13/MatplotLibAPI/__init__.py +0 -325
- matplotlibapi-3.2.13/MatplotLibAPI.egg-info/PKG-INFO +0 -24
- matplotlibapi-3.2.13/MatplotLibAPI.egg-info/SOURCES.txt +0 -17
- matplotlibapi-3.2.13/MatplotLibAPI.egg-info/dependency_links.txt +0 -1
- matplotlibapi-3.2.13/MatplotLibAPI.egg-info/requires.txt +0 -8
- matplotlibapi-3.2.13/MatplotLibAPI.egg-info/top_level.txt +0 -1
- matplotlibapi-3.2.13/PKG-INFO +0 -24
- matplotlibapi-3.2.13/README.md +0 -8
- matplotlibapi-3.2.13/pyproject.toml +0 -11
- matplotlibapi-3.2.13/setup.cfg +0 -4
- {matplotlibapi-3.2.13 → matplotlibapi-3.2.15}/LICENSE +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Python CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v3
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v4
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -e .[dev]
|
|
31
|
+
|
|
32
|
+
- name: Run style checks
|
|
33
|
+
run: |
|
|
34
|
+
pydocstyle MatplotLibAPI
|
|
35
|
+
black --check .
|
|
36
|
+
|
|
37
|
+
- name: Run static type analysis
|
|
38
|
+
run: |
|
|
39
|
+
pyright MatplotLibAPI
|
|
40
|
+
|
|
41
|
+
- name: Run tests with coverage
|
|
42
|
+
run: |
|
|
43
|
+
pytest -q --cov=MatplotLibAPI --cov-report=term-missing --cov-fail-under=70
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
deploy:
|
|
20
|
+
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v3
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v3
|
|
27
|
+
with:
|
|
28
|
+
python-version: '3.x'
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install build
|
|
33
|
+
- name: Build package
|
|
34
|
+
run: python -m build
|
|
35
|
+
- name: Publish package
|
|
36
|
+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
37
|
+
with:
|
|
38
|
+
user: __token__
|
|
39
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.vscode
|
|
3
|
+
.env
|
|
4
|
+
.pytest_cache
|
|
5
|
+
.benchmarks
|
|
6
|
+
scratch*
|
|
7
|
+
data/
|
|
8
|
+
# Python build artifacts
|
|
9
|
+
*.egg-info/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
|
|
13
|
+
# Python cache files
|
|
14
|
+
__pycache__/
|
|
15
|
+
*.py[cod]
|
|
16
|
+
|
|
17
|
+
# Virtual environments
|
|
18
|
+
.venv/
|
|
19
|
+
.coverage
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
These instructions apply to any automated agent contributing to this repository.
|
|
4
|
+
|
|
5
|
+
## 1. Code Style
|
|
6
|
+
|
|
7
|
+
- Use standard PEP 8 formatting for all Python code.
|
|
8
|
+
- Write commit messages in the imperative mood (e.g., "Add feature" not "Added feature").
|
|
9
|
+
- Keep the implementation Pythonic and maintainable.
|
|
10
|
+
|
|
11
|
+
## 2. Docstring Style
|
|
12
|
+
|
|
13
|
+
- Document all public classes, parameters, methods, and functions.
|
|
14
|
+
- Use **NumPy-style** docstrings following [PEP 257](httpshttps://peps.python.org/pep-0257/) conventions.
|
|
15
|
+
- **Do not** use `:param` / `:type` syntax (reST/Sphinx style) or Google-style `Args`.
|
|
16
|
+
- Always include type hints in function signatures.
|
|
17
|
+
- Begin docstrings with a **short, one-line summary**, followed by a blank line and an optional extended description.
|
|
18
|
+
- Use the following NumPy-style sections when applicable:
|
|
19
|
+
- `Parameters`
|
|
20
|
+
- `Returns`
|
|
21
|
+
- `Raises`
|
|
22
|
+
- `Examples`
|
|
23
|
+
- **For classes, the main docstring should include a `Methods` section summarizing each public method and its one-line description.**
|
|
24
|
+
- For optional parameters, note the default value in the description.
|
|
25
|
+
- Use present tense and active voice (“Return…”, “Fetch…”).
|
|
26
|
+
|
|
27
|
+
## 3. Code Quality and Testing
|
|
28
|
+
|
|
29
|
+
Before running tests, install the development dependencies declared in `pyproject.toml`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install -e .[dev]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To ensure your changes will pass the automated checks in our Continuous Integration (CI) pipeline, run the following commands locally before committing. All checks must pass.
|
|
36
|
+
|
|
37
|
+
**Style Checks:**
|
|
38
|
+
```bash
|
|
39
|
+
pydocstyle MatplotLibAPI
|
|
40
|
+
black --check .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Static Type Analysis:**
|
|
44
|
+
```bash
|
|
45
|
+
pyright MatplotLibAPI
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Unit Tests and Coverage:**
|
|
49
|
+
```bash
|
|
50
|
+
pytest -q --cov=MatplotLibAPI --cov-report=term-missing --cov-fail-under=70
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 4. Directory Layout
|
|
54
|
+
|
|
55
|
+
- Production code lives in `MatplotLibAPI/`.
|
|
56
|
+
- Tests live in `tests/`.
|
|
57
|
+
- Keep imports relative within the package (e.g., `from MatplotLibAPI...`).
|
|
58
|
+
|
|
59
|
+
## 5. Pull Request Messages
|
|
60
|
+
|
|
61
|
+
Each pull request should include:
|
|
62
|
+
|
|
63
|
+
1. **Summary** – brief description of the change.
|
|
64
|
+
2. **Testing** – commands run and confirmation that the tests passed.
|
|
65
|
+
|
|
66
|
+
Example PR body:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
### Summary
|
|
70
|
+
- add new helper to utils.list
|
|
71
|
+
- expand tests for list chunking
|
|
72
|
+
|
|
73
|
+
### Testing
|
|
74
|
+
- `pytest` (all tests passed)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 6. General Guidelines
|
|
78
|
+
|
|
79
|
+
- Avoid pushing large data files to the repository.
|
|
80
|
+
- Prefer small, focused commits over sweeping changes.
|
|
81
|
+
- Update or add tests whenever you modify functionality.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Area chart helpers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional, Tuple
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
6
|
+
from matplotlib.axes import Axes
|
|
7
|
+
from matplotlib.figure import Figure
|
|
8
|
+
|
|
9
|
+
from .StyleTemplate import (
|
|
10
|
+
AREA_STYLE_TEMPLATE,
|
|
11
|
+
StyleTemplate,
|
|
12
|
+
string_formatter,
|
|
13
|
+
validate_dataframe,
|
|
14
|
+
)
|
|
15
|
+
from ._visualization_utils import _get_axis, _wrap_aplot
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def aplot_area(
|
|
19
|
+
pd_df: pd.DataFrame,
|
|
20
|
+
x: str,
|
|
21
|
+
y: str,
|
|
22
|
+
label: Optional[str] = None,
|
|
23
|
+
stacked: bool = True,
|
|
24
|
+
title: Optional[str] = None,
|
|
25
|
+
style: StyleTemplate = AREA_STYLE_TEMPLATE,
|
|
26
|
+
ax: Optional[Axes] = None,
|
|
27
|
+
**kwargs: Any,
|
|
28
|
+
) -> Axes:
|
|
29
|
+
"""Plot area charts, optionally stacked for part-to-whole trends."""
|
|
30
|
+
cols = [x, y]
|
|
31
|
+
if label:
|
|
32
|
+
cols.append(label)
|
|
33
|
+
validate_dataframe(pd_df, cols=cols)
|
|
34
|
+
plot_ax = _get_axis(ax)
|
|
35
|
+
|
|
36
|
+
if label:
|
|
37
|
+
pivot_df = pd_df.pivot_table(
|
|
38
|
+
index=x, columns=label, values=y, aggfunc="sum"
|
|
39
|
+
).sort_index()
|
|
40
|
+
pivot_df.plot(kind="area", stacked=stacked, alpha=0.7, ax=plot_ax)
|
|
41
|
+
else:
|
|
42
|
+
sorted_df = pd_df.sort_values(by=x)
|
|
43
|
+
plot_ax.fill_between(
|
|
44
|
+
sorted_df[x], sorted_df[y], color=style.font_color, alpha=0.4
|
|
45
|
+
)
|
|
46
|
+
plot_ax.plot(sorted_df[x], sorted_df[y], color=style.font_color)
|
|
47
|
+
|
|
48
|
+
plot_ax.set_xlabel(string_formatter(x))
|
|
49
|
+
plot_ax.set_ylabel(string_formatter(y))
|
|
50
|
+
if title:
|
|
51
|
+
plot_ax.set_title(title)
|
|
52
|
+
return plot_ax
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def fplot_area(
|
|
56
|
+
pd_df: pd.DataFrame,
|
|
57
|
+
x: str,
|
|
58
|
+
y: str,
|
|
59
|
+
label: Optional[str] = None,
|
|
60
|
+
stacked: bool = True,
|
|
61
|
+
title: Optional[str] = None,
|
|
62
|
+
style: StyleTemplate = AREA_STYLE_TEMPLATE,
|
|
63
|
+
figsize: Tuple[float, float] = (10, 6),
|
|
64
|
+
) -> Figure:
|
|
65
|
+
"""Plot area charts on a new figure."""
|
|
66
|
+
return _wrap_aplot(
|
|
67
|
+
aplot_area,
|
|
68
|
+
pd_df=pd_df,
|
|
69
|
+
figsize=figsize,
|
|
70
|
+
x=x,
|
|
71
|
+
y=y,
|
|
72
|
+
label=label,
|
|
73
|
+
stacked=stacked,
|
|
74
|
+
title=title,
|
|
75
|
+
style=style,
|
|
76
|
+
)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Bar and stacked bar chart helpers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional, Tuple
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
6
|
+
import seaborn as sns
|
|
7
|
+
from matplotlib.axes import Axes
|
|
8
|
+
from matplotlib.figure import Figure
|
|
9
|
+
|
|
10
|
+
from .StyleTemplate import (
|
|
11
|
+
DISTRIBUTION_STYLE_TEMPLATE,
|
|
12
|
+
StyleTemplate,
|
|
13
|
+
string_formatter,
|
|
14
|
+
validate_dataframe,
|
|
15
|
+
)
|
|
16
|
+
from ._visualization_utils import _get_axis, _wrap_aplot
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def aplot_bar(
|
|
20
|
+
pd_df: pd.DataFrame,
|
|
21
|
+
category: str,
|
|
22
|
+
value: str,
|
|
23
|
+
group: Optional[str] = None,
|
|
24
|
+
stacked: bool = False,
|
|
25
|
+
title: Optional[str] = None,
|
|
26
|
+
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
27
|
+
ax: Optional[Axes] = None,
|
|
28
|
+
**kwargs: Any,
|
|
29
|
+
) -> Axes:
|
|
30
|
+
"""Plot bar or stacked bar charts for categorical comparisons."""
|
|
31
|
+
cols = [category, value]
|
|
32
|
+
if group:
|
|
33
|
+
cols.append(group)
|
|
34
|
+
validate_dataframe(pd_df, cols=cols)
|
|
35
|
+
|
|
36
|
+
plot_ax = _get_axis(ax)
|
|
37
|
+
plot_df = pd_df.copy()
|
|
38
|
+
|
|
39
|
+
if group:
|
|
40
|
+
pivot_df = plot_df.pivot_table(
|
|
41
|
+
index=category, columns=group, values=value, aggfunc="sum"
|
|
42
|
+
)
|
|
43
|
+
pivot_df.plot(kind="bar", stacked=stacked, ax=plot_ax, alpha=0.85)
|
|
44
|
+
else:
|
|
45
|
+
sns.barplot(
|
|
46
|
+
data=plot_df, x=category, y=value, palette=style.palette, ax=plot_ax
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
plot_ax.set_facecolor(style.background_color)
|
|
50
|
+
plot_ax.set_xlabel(string_formatter(category))
|
|
51
|
+
plot_ax.set_ylabel(string_formatter(value))
|
|
52
|
+
if title:
|
|
53
|
+
plot_ax.set_title(title)
|
|
54
|
+
plot_ax.tick_params(axis="x", labelrotation=45)
|
|
55
|
+
return plot_ax
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def fplot_bar(
|
|
59
|
+
pd_df: pd.DataFrame,
|
|
60
|
+
category: str,
|
|
61
|
+
value: str,
|
|
62
|
+
group: Optional[str] = None,
|
|
63
|
+
stacked: bool = False,
|
|
64
|
+
title: Optional[str] = None,
|
|
65
|
+
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
66
|
+
figsize: Tuple[float, float] = (10, 6),
|
|
67
|
+
) -> Figure:
|
|
68
|
+
"""Plot bar or stacked bar charts on a new figure."""
|
|
69
|
+
return _wrap_aplot(
|
|
70
|
+
aplot_bar,
|
|
71
|
+
pd_df=pd_df,
|
|
72
|
+
figsize=figsize,
|
|
73
|
+
category=category,
|
|
74
|
+
value=value,
|
|
75
|
+
group=group,
|
|
76
|
+
stacked=stacked,
|
|
77
|
+
title=title,
|
|
78
|
+
style=style,
|
|
79
|
+
)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Box and violin plot helpers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional, Tuple
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
6
|
+
import seaborn as sns
|
|
7
|
+
from matplotlib.axes import Axes
|
|
8
|
+
from matplotlib.figure import Figure
|
|
9
|
+
|
|
10
|
+
from .StyleTemplate import (
|
|
11
|
+
DISTRIBUTION_STYLE_TEMPLATE,
|
|
12
|
+
StyleTemplate,
|
|
13
|
+
string_formatter,
|
|
14
|
+
validate_dataframe,
|
|
15
|
+
)
|
|
16
|
+
from ._visualization_utils import _get_axis, _wrap_aplot
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def aplot_box_violin(
|
|
20
|
+
pd_df: pd.DataFrame,
|
|
21
|
+
column: str,
|
|
22
|
+
by: Optional[str] = None,
|
|
23
|
+
violin: bool = False,
|
|
24
|
+
title: Optional[str] = None,
|
|
25
|
+
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
26
|
+
ax: Optional[Axes] = None,
|
|
27
|
+
**kwargs: Any,
|
|
28
|
+
) -> Axes:
|
|
29
|
+
"""Plot box or violin charts to summarize distributions."""
|
|
30
|
+
cols = [column]
|
|
31
|
+
if by:
|
|
32
|
+
cols.append(by)
|
|
33
|
+
validate_dataframe(pd_df, cols=cols)
|
|
34
|
+
plot_ax = _get_axis(ax)
|
|
35
|
+
|
|
36
|
+
if violin:
|
|
37
|
+
sns.violinplot(data=pd_df, x=by, y=column, palette=style.palette, ax=plot_ax)
|
|
38
|
+
else:
|
|
39
|
+
sns.boxplot(data=pd_df, x=by, y=column, palette=style.palette, ax=plot_ax)
|
|
40
|
+
|
|
41
|
+
plot_ax.set_facecolor(style.background_color)
|
|
42
|
+
plot_ax.set_ylabel(string_formatter(column))
|
|
43
|
+
if by:
|
|
44
|
+
plot_ax.set_xlabel(string_formatter(by))
|
|
45
|
+
if title:
|
|
46
|
+
plot_ax.set_title(title)
|
|
47
|
+
return plot_ax
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def fplot_box_violin(
|
|
51
|
+
pd_df: pd.DataFrame,
|
|
52
|
+
column: str,
|
|
53
|
+
by: Optional[str] = None,
|
|
54
|
+
violin: bool = False,
|
|
55
|
+
title: Optional[str] = None,
|
|
56
|
+
style: StyleTemplate = DISTRIBUTION_STYLE_TEMPLATE,
|
|
57
|
+
figsize: Tuple[float, float] = (10, 6),
|
|
58
|
+
) -> Figure:
|
|
59
|
+
"""Plot box or violin charts on a new figure."""
|
|
60
|
+
return _wrap_aplot(
|
|
61
|
+
aplot_box_violin,
|
|
62
|
+
pd_df=pd_df,
|
|
63
|
+
figsize=figsize,
|
|
64
|
+
column=column,
|
|
65
|
+
by=by,
|
|
66
|
+
violin=violin,
|
|
67
|
+
title=title,
|
|
68
|
+
style=style,
|
|
69
|
+
)
|