plotly-extend-wrapper 1.0.1__tar.gz → 1.1.0__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 (29) hide show
  1. plotly_extend_wrapper-1.1.0/.devcontainer/Dockerfile +43 -0
  2. plotly_extend_wrapper-1.1.0/.devcontainer/devcontainer.json +32 -0
  3. plotly_extend_wrapper-1.1.0/.github/workflows/deploy_pages.yaml +44 -0
  4. plotly_extend_wrapper-1.1.0/.github/workflows/pypi_release.yml +25 -0
  5. plotly_extend_wrapper-1.1.0/.github/workflows/unittest.yml +24 -0
  6. plotly_extend_wrapper-1.1.0/.gitignore +159 -0
  7. plotly_extend_wrapper-1.1.0/.python-version +1 -0
  8. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/PKG-INFO +9 -15
  9. plotly_extend_wrapper-1.1.0/codecov.yaml +13 -0
  10. plotly_extend_wrapper-1.1.0/docs/Makefile +20 -0
  11. plotly_extend_wrapper-1.1.0/docs/conf.py +30 -0
  12. plotly_extend_wrapper-1.1.0/docs/index.rst +49 -0
  13. plotly_extend_wrapper-1.1.0/docs/make.bat +35 -0
  14. plotly_extend_wrapper-1.1.0/docs/source/introduction.md +1 -0
  15. plotly_extend_wrapper-1.1.0/docs/source/wrapper.md +49 -0
  16. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/plotly_extend_wrapper/__init__.py +1 -1
  17. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/plotly_extend_wrapper/wrapper.py +53 -0
  18. plotly_extend_wrapper-1.1.0/pyproject.toml +41 -0
  19. plotly_extend_wrapper-1.1.0/requirements-dev.lock +246 -0
  20. plotly_extend_wrapper-1.1.0/requirements.lock +38 -0
  21. plotly_extend_wrapper-1.1.0/test/test_common.py +15 -0
  22. plotly_extend_wrapper-1.1.0/test/test_updater.py +106 -0
  23. plotly_extend_wrapper-1.1.0/test/test_wrapper.py +315 -0
  24. plotly_extend_wrapper-1.0.1/plotly_extend_wrapper/release_library.sh +0 -7
  25. plotly_extend_wrapper-1.0.1/pyproject.toml +0 -35
  26. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/LICENSE +0 -0
  27. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/README.md +0 -0
  28. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/plotly_extend_wrapper/common.py +0 -0
  29. {plotly_extend_wrapper-1.0.1 → plotly_extend_wrapper-1.1.0}/plotly_extend_wrapper/updater.py +0 -0
@@ -0,0 +1,43 @@
1
+ FROM mcr.microsoft.com/devcontainers/base:jammy
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+ ARG USER=vscode
5
+
6
+ RUN DEBIAN_FRONTEND=noninteractive \
7
+ && apt-get update \
8
+ && apt-get install -y build-essential --no-install-recommends make \
9
+ ca-certificates \
10
+ git \
11
+ libssl-dev \
12
+ zlib1g-dev \
13
+ libbz2-dev \
14
+ libreadline-dev \
15
+ libsqlite3-dev \
16
+ wget \
17
+ curl \
18
+ llvm \
19
+ libncurses5-dev \
20
+ xz-utils \
21
+ tk-dev \
22
+ libxml2-dev \
23
+ libxmlsec1-dev \
24
+ libffi-dev \
25
+ liblzma-dev
26
+
27
+ # Python and poetry installation
28
+ USER $USER
29
+ ARG HOME="/home/$USER"
30
+ ARG PYTHON_VERSION=3.10
31
+
32
+ ENV PYENV_ROOT="${HOME}/.pyenv"
33
+ ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${HOME}/.local/bin:$PATH"
34
+
35
+ RUN echo "Installing pyenv" \
36
+ && curl https://pyenv.run | bash \
37
+ && echo "Installing Python" \
38
+ && pyenv install ${PYTHON_VERSION} \
39
+ && echo "Setting Python version" \
40
+ && pyenv global ${PYTHON_VERSION} \
41
+ && echo "Installing poetry" \
42
+ && curl -sSL https://install.python-poetry.org | python3 - \
43
+ && poetry config virtualenvs.in-project true
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "poetry3-poetry-pyenv",
3
+ "build": {
4
+ "dockerfile": "Dockerfile"
5
+ },
6
+
7
+ // 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
8
+ // "features": {},
9
+
10
+ // 👇 Use 'forwardPorts' to make a list of ports inside the container available locally.
11
+ // "forwardPorts": [],
12
+
13
+ // 👇 Use 'postCreateCommand' to run commands after the container is created.
14
+ // "postCreateCommand": "",
15
+
16
+ // 👇 Configure tool-specific properties.
17
+ "customizations": {
18
+ "vscode": {
19
+ "extensions":[
20
+ "ms-python.python",
21
+ "njpwerner.autodocstring",
22
+ "charliermarsh.ruff",
23
+ ]
24
+ }
25
+ },
26
+ "features": {
27
+ "ghcr.io/devcontainers-contrib/features/live-server:1": {}
28
+ }
29
+
30
+ // 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
31
+ // "remoteUser": "root"
32
+ }
@@ -0,0 +1,44 @@
1
+ name: Deploy Sphinx documentation to Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main, rye] # branch to trigger deployment
6
+
7
+ concurrency:
8
+ group: "pages"
9
+ cancel-in-progress: false
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+ - name: Install a specific version
18
+ uses: eifinger/setup-rye@v3
19
+ with:
20
+ version: 'latest'
21
+ - name: Install dependencies
22
+ run: rye sync
23
+ - name: Build Sphinx
24
+ run: rye run sphinx-build docs/ docs/_build
25
+
26
+ deploy:
27
+ needs: build
28
+ runs-on: ubuntu-latest
29
+ permissions:
30
+ pages: write
31
+ id-token: write
32
+ environment:
33
+ name: github-pages
34
+ url: ${{ steps.deployment.outputs.page_url }}
35
+ steps:
36
+ # - name: Setup Pages
37
+ # uses: actions/configure-pages
38
+ - name: Upload artifact
39
+ uses: actions/upload-pages-artifact@v3
40
+ with:
41
+ path: 'docs/_build'
42
+ - name: Deploy to GitHub Pages
43
+ id: deployment
44
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,25 @@
1
+ name: Release package to pypi
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Install a specific version
13
+ uses: eifinger/setup-rye@v3
14
+ with:
15
+ version: 'latest'
16
+ - name: Install dependencies
17
+ run: rye sync
18
+ - name: Build
19
+ run: rye build
20
+ - name: Publish a Python distribution to PyPI
21
+ if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
22
+ uses: pypa/gh-action-pypi-publish@release/v1.8
23
+ with:
24
+ user: __token__
25
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,24 @@
1
+ name: Unit test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ Unit-test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Install a specific version
13
+ uses: eifinger/setup-rye@v3
14
+ with:
15
+ version: 'latest'
16
+ - name: Install dependencies
17
+ run: rye sync
18
+ - name: Test
19
+ run: |
20
+ rye run pytest test --cov=./plotly_extend_wrapper --cov-report=xml
21
+ - name: Upload coverage reports to Codecov
22
+ uses: codecov/codecov-action@v4
23
+ env:
24
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,159 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ develop-eggs/
12
+ dist/
13
+ downloads/
14
+ eggs/
15
+ .eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ share/python-wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+ cover/
52
+
53
+ # Translations
54
+ *.mo
55
+ *.pot
56
+
57
+ # Django stuff:
58
+ *.log
59
+ local_settings.py
60
+ db.sqlite3
61
+ db.sqlite3-journal
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+ # Scrapy stuff:
68
+ .scrapy
69
+
70
+ # Sphinx documentation
71
+ docs/_build/
72
+
73
+ # PyBuilder
74
+ .pybuilder/
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ # For a library or package, you might want to ignore these files since the code is
86
+ # intended to run in multiple environments; otherwise, check them in:
87
+ # .python-version
88
+
89
+ # pipenv
90
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
92
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
93
+ # install all needed dependencies.
94
+ #Pipfile.lock
95
+
96
+ # poetry
97
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
98
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
99
+ # commonly ignored for libraries.
100
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
101
+ #poetry.lock
102
+
103
+ # pdm
104
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
105
+ #pdm.lock
106
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
107
+ # in version control.
108
+ # https://pdm.fming.dev/#use-with-ide
109
+ .pdm.toml
110
+
111
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
112
+ __pypackages__/
113
+
114
+ # Celery stuff
115
+ celerybeat-schedule
116
+ celerybeat.pid
117
+
118
+ # SageMath parsed files
119
+ *.sage.py
120
+
121
+ # Environments
122
+ .env
123
+ .venv
124
+ env/
125
+ venv/
126
+ ENV/
127
+ env.bak/
128
+ venv.bak/
129
+
130
+ # Spyder project settings
131
+ .spyderproject
132
+ .spyproject
133
+
134
+ # Rope project settings
135
+ .ropeproject
136
+
137
+ # mkdocs documentation
138
+ /site
139
+
140
+ # mypy
141
+ .mypy_cache/
142
+ .dmypy.json
143
+ dmypy.json
144
+
145
+ # Pyre type checker
146
+ .pyre/
147
+
148
+ # pytype static type analyzer
149
+ .pytype/
150
+
151
+ # Cython debug symbols
152
+ cython_debug/
153
+
154
+ # PyCharm
155
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
156
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
157
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
158
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
159
+ #.idea/
@@ -0,0 +1 @@
1
+ 3.9.19
@@ -1,19 +1,14 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: plotly-extend-wrapper
3
- Version: 1.0.1
4
- Summary:
5
- Author: Toru Sumi
6
- Author-email: prayonshootingstars@gmail.com
3
+ Version: 1.1.0
4
+ Author-email: Laplusdestiny <prayonshootingstars@gmail.com>
5
+ License-File: LICENSE
7
6
  Requires-Python: >=3.9
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: kaleido (==0.2.1)
14
- Requires-Dist: pandas (>=2.0.0,<3.0.0)
15
- Requires-Dist: plotly (>=5.15.0,<6.0.0)
16
- Requires-Dist: pyarrow
7
+ Requires-Dist: kaleido==0.2.1
8
+ Requires-Dist: pandas>=2.0.0
9
+ Requires-Dist: plotly>=5.15.0
10
+ Requires-Dist: pyarrow>=10.0.0
11
+ Requires-Dist: scipy>=1.12.0
17
12
  Description-Content-Type: text/markdown
18
13
 
19
14
  # plotly_extend_wrapper
@@ -65,4 +60,3 @@ You can make plot simply
65
60
  If there are some bugs, please make issue to tell me!
66
61
 
67
62
  [![GitHub issues](https://img.shields.io/github/issues/Laplusdestiny/plotly_extend_wrapper?logo=github)](https://github.com/Laplusdestiny/plotly_extend_wrapper/issues)
68
-
@@ -0,0 +1,13 @@
1
+ coverage:
2
+ status:
3
+ project:
4
+ default:
5
+ target: 100%
6
+ threshold: 1%
7
+ comment: # this is a top-level key
8
+ layout: " diff, flags, files"
9
+ behavior: default
10
+ require_changes: false # if true: only post the comment if coverage changes
11
+ require_base: false # [true :: must have a base report to post]
12
+ require_head: true # [true :: must have a head report to post]
13
+ hide_project_coverage: false # [true :: only show coverage on the git diff]
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,30 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # -- Project information -----------------------------------------------------
7
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
+
9
+ project = 'plotly-extend-wrapper'
10
+ copyright = '2024, Laplusdestiny'
11
+ author = 'Laplusdestiny'
12
+
13
+ # -- General configuration ---------------------------------------------------
14
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
15
+
16
+ extensions = ['myst_parser', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon']
17
+
18
+ templates_path = ['_templates']
19
+ exclude_patterns = []
20
+ source_suffix = {
21
+ '.rst': 'restructuredtext',
22
+ '.txt': 'markdown',
23
+ '.md': 'markdown',
24
+ }
25
+
26
+ # -- Options for HTML output -------------------------------------------------
27
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
28
+
29
+ html_theme = 'furo'
30
+ html_static_path = ['_static']
@@ -0,0 +1,49 @@
1
+ .. plotly-extend-wrapper documentation master file, created by
2
+ sphinx-quickstart on Fri Apr 12 16:08:02 2024.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ Welcome to plotly-extend-wrapper's documentation!
7
+ =================================================
8
+
9
+ .. toctree::
10
+ :maxdepth: 2
11
+ :caption: Contents:
12
+
13
+ source/introduction
14
+ source/wrapper
15
+
16
+
17
+ =========
18
+
19
+ .. image:: https://img.shields.io/github/last-commit/Laplusdestiny/plotly_extend_wrapper?display_timestamp=author&logo=github
20
+ :alt: GitHub last commit
21
+ :target: https://github.com/Laplusdestiny/plotly_extend_wrapper/commits/main/
22
+
23
+ .. image:: https://img.shields.io/codecov/c/github/Laplusdestiny/plotly_extend_wrapper?style=flat&logo=codecov
24
+ :alt: Codecov
25
+ :target: https://app.codecov.io/gh/Laplusdestiny/plotly_extend_wrapper
26
+
27
+ .. image:: https://img.shields.io/github/release-date/Laplusdestiny/plotly_extend_wrapper?logo=github
28
+ :alt: GitHub Release Date
29
+ :target: https://github.com/Laplusdestiny/plotly_extend_wrapper/releases
30
+
31
+ .. image:: https://img.shields.io/pypi/v/plotly-extend-wrapper?logo=pypi
32
+ :alt: PyPI - Version
33
+ :target: https://pypi.org/project/plotly-extend-wrapper/
34
+
35
+ Certainly! Here's an introduction for the top page of the Plotly-Extend-Wrapper
36
+ library:
37
+
38
+ Plotly-Extend-Wrapper: Extended Plotly for Interactive Graphs
39
+ -------------------------------------------------------------
40
+
41
+ Overview: Plotly-Extend-Wrapper is a Python library that extends the capabilities of Plotly, an interactive graphing library. While Plotly provides powerful tools for creating visualizations, Plotly-Extend-Wrapper offers additional features that are not readily available through simple options or methods in the official Plotly library.
42
+
43
+
44
+ Key Features:
45
+ -------------
46
+
47
+ 1. Seamless Integration with Plotly: Plotly-Extend-Wrapper seamlessly integrates with Plotly, allowing users to leverage the existing functionality while enhancing it with additional features.Users can continue using familiar Plotly syntax and methods, but with added capabilities.
48
+ 2. Advanced Methods for Common Tasks: Plotly-Extend-Wrapper provides convenient methods for tasks that are commonly required but not directly available in the standard Plotly library.Users can easily perform complex operations without having to write custom code.
49
+ 3. Automated Data Preprocessing: Some graph types require specific data formats or preprocessing steps before visualization.Plotly-Extend-Wrapper automatically handles data preprocessing for certain graph types, making it easier for users to create meaningful visualizations without manual data manipulation.
@@ -0,0 +1,35 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=source
11
+ set BUILDDIR=build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
@@ -0,0 +1 @@
1
+ # introduction
@@ -0,0 +1,49 @@
1
+ # wrapper
2
+
3
+ ## Plot_pie
4
+
5
+ > Plot_pie(data: `pd.DataFrame`, target: `str`, **kwargs)
6
+
7
+ Make pie plot
8
+
9
+ ### Parameters
10
+ - data : `pd.DataFrame`
11
+ - pandas.DataFrame included data to make pie chart
12
+ - target : `str`
13
+ - String which column you would like to use for pie chart
14
+
15
+ ### Returns
16
+
17
+ `plotly.graph_objects`
18
+
19
+ Object of pie chart
20
+
21
+
22
+ ## Plot_sunburst
23
+
24
+ > Plot_sunburst(data: `pd.DataFrame`, groups: `list`, **kwargs)
25
+
26
+ Make sunburst plot
27
+
28
+ ### Parameters
29
+ - data : `pd.DataFrame`
30
+ - pandas.DataFrame included data to make sunburst chart
31
+ - group : `list`
32
+ - Strings list of group
33
+ - Changed when you replace the order
34
+
35
+ ### Returns
36
+
37
+ `plotly.graph_objects`
38
+
39
+ Object of sunburst chart
40
+
41
+ ## Plot_bubble_chart
42
+
43
+
44
+ ## Plot_line
45
+
46
+
47
+ ## Plot_bubble_chart_with_line
48
+
49
+
@@ -2,4 +2,4 @@ from plotly_extend_wrapper.wrapper import *
2
2
  from plotly_extend_wrapper.updater import *
3
3
  from plotly_extend_wrapper.common import *
4
4
 
5
- __version__ = "1.0.1"
5
+ __version__ = "1.1.0"
@@ -2,6 +2,9 @@ from plotly import express as px
2
2
  from plotly.subplots import make_subplots
3
3
  import pandas as pd
4
4
  from plotly_extend_wrapper.common import check_directory
5
+ from plotly import graph_objects as go
6
+ from scipy.interpolate import griddata
7
+ import numpy as np
5
8
 
6
9
 
7
10
  def Plot_pie(data: pd.DataFrame, target: str, **kwargs):
@@ -369,3 +372,53 @@ def Plot_bubble_chart_with_line(
369
372
  subfig.layout.yaxis.title = ytitle
370
373
  subfig.update_layout(**kwargs)
371
374
  return subfig
375
+
376
+
377
+ def Plot_surface(
378
+ df: pd.DataFrame,
379
+ x: str,
380
+ y: str,
381
+ z: str,
382
+ fill_value=0,
383
+ smoothing=False,
384
+ smooth_point_num=100,
385
+ title=None,
386
+ height=None,
387
+ width=None,
388
+ **kwargs,
389
+ ):
390
+ def smooth_df(x: np.ndarray, y: np.ndarray, z: np.ndarray, num: int):
391
+ xi = np.linspace(x.min(), x.max(), num)
392
+ yi = np.linspace(y.min(), y.max(), num)
393
+ xi, yi = np.meshgrid(xi, yi)
394
+ zi = griddata((x,y), z, (xi.ravel(), yi.ravel()), method="cubic")
395
+ zi = zi.reshape(xi.shape)
396
+ zi = np.nan_to_num(zi)
397
+ return xi, yi, zi
398
+
399
+ if smoothing:
400
+ X = df[x].values
401
+ Y = df[y].values
402
+ Z = df[z].values
403
+ X, Y, Z = smooth_df(X, Y, Z, smooth_point_num)
404
+ else:
405
+ pivot_df = pd.pivot_table(df, index=x, columns=y, values=z, fill_value=fill_value)
406
+
407
+ X = pivot_df.columns.values
408
+ Y = pivot_df.index.values
409
+ Z = pivot_df.values
410
+
411
+
412
+ data = [go.Surface(x=X, y=Y, z=Z)]
413
+ layout = go.Layout(
414
+ title=title,
415
+ scene=dict(
416
+ xaxis=dict(title=y), # need to be replaced
417
+ yaxis=dict(title=x),
418
+ zaxis=dict(title=z),
419
+ ),
420
+ height=height,
421
+ width=width,
422
+ )
423
+ fig = go.Figure(data=data, layout=layout)
424
+ return fig
@@ -0,0 +1,41 @@
1
+ [project]
2
+ name = "plotly-extend-wrapper"
3
+ version = "1.1.0"
4
+ authors = [
5
+ { name = "Laplusdestiny", email = "prayonshootingstars@gmail.com" }
6
+ ]
7
+ dependencies = [
8
+ "plotly>=5.15.0",
9
+ "kaleido==0.2.1",
10
+ "pyarrow>=10.0.0",
11
+ "pandas>=2.0.0",
12
+ "scipy>=1.12.0",
13
+ ]
14
+ readme = "README.md"
15
+ requires-python = ">= 3.9"
16
+
17
+ [build-system]
18
+ requires = ["hatchling"]
19
+ build-backend = "hatchling.build"
20
+
21
+ [tool.rye]
22
+ managed = true
23
+ dev-dependencies = [
24
+ "ruff>=0.5.0",
25
+ "ipykernel>=6.29.4",
26
+ "pytest>=8.2.2",
27
+ "pytest-cov>=5.0.0",
28
+ "scikit-learn>=1.5.1",
29
+ "twine>=5.1.1",
30
+ "wheel>=0.43.0",
31
+ "build>=1.2.1",
32
+ "sphinx>=7.3.7",
33
+ "myst-parser>=3.0.1",
34
+ "furo>=2024.5.6",
35
+ ]
36
+
37
+ [tool.hatch.metadata]
38
+ allow-direct-references = true
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["plotly_extend_wrapper/"]