legendkit 0.3.2__tar.gz → 0.3.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.
- legendkit-0.3.4/.github/workflows/build.yaml +57 -0
- legendkit-0.3.4/.gitignore +163 -0
- legendkit-0.3.4/LICENSE +21 -0
- {legendkit-0.3.2 → legendkit-0.3.4}/PKG-INFO +21 -17
- {legendkit-0.3.2 → legendkit-0.3.4}/README.md +1 -1
- legendkit-0.3.4/docs/Makefile +20 -0
- legendkit-0.3.4/docs/make.bat +35 -0
- legendkit-0.3.4/docs/requirements.txt +7 -0
- legendkit-0.3.4/docs/source/.gitignore +1 -0
- legendkit-0.3.4/docs/source/_templates/autosummary/class.rst +12 -0
- legendkit-0.3.4/docs/source/api.rst +16 -0
- legendkit-0.3.4/docs/source/conf.py +88 -0
- legendkit-0.3.4/docs/source/cover.py +95 -0
- legendkit-0.3.4/docs/source/index.rst +43 -0
- legendkit-0.3.4/docs/source/styles.mplstyle +33 -0
- legendkit-0.3.4/docs/source/tutorial/colorbar.rst +29 -0
- legendkit-0.3.4/docs/source/tutorial/layout.rst +51 -0
- legendkit-0.3.4/docs/source/tutorial/legend.rst +105 -0
- legendkit-0.3.4/docs/source/tutorial/matplotlib_legend.rst +34 -0
- legendkit-0.3.4/docs/source/tutorial/title&layout.rst +85 -0
- legendkit-0.3.4/examples/example1.py +31 -0
- legendkit-0.3.4/examples/example2.py +32 -0
- legendkit-0.3.4/examples/example3.py +30 -0
- legendkit-0.3.4/examples/full_examples.py +86 -0
- legendkit-0.3.4/images/example1-2.svg +1120 -0
- legendkit-0.3.4/images/example1.svg +2022 -0
- legendkit-0.3.4/images/example2-2.svg +578 -0
- legendkit-0.3.4/images/example2.svg +304 -0
- legendkit-0.3.4/images/example3.svg +902 -0
- legendkit-0.3.4/images/handle_label_illustration.png +0 -0
- legendkit-0.3.4/images/handle_label_illustration.svg +16 -0
- legendkit-0.3.4/images/illustration.excalidraw +1711 -0
- legendkit-0.3.4/images/layout_padding_illustration.png +0 -0
- legendkit-0.3.4/images/layout_padding_illustration.svg +16 -0
- legendkit-0.3.4/images/legendkit-logo.svg +1 -0
- legendkit-0.3.4/images/legendkit-project.svg +1 -0
- legendkit-0.3.4/images/showcase.svg +3651 -0
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/__init__.py +5 -1
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_colorart.py +37 -10
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_colorbar.py +2 -2
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_legend.py +42 -16
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_locs.py +19 -4
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/handles.py +2 -1
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/layout.py +2 -2
- legendkit-0.3.4/pyproject.toml +39 -0
- legendkit-0.3.4/readthedocs.yaml +12 -0
- legendkit-0.3.4/renovate.json +5 -0
- legendkit-0.3.4/setup.py +4 -0
- legendkit-0.3.4/tests/test_colorart.py +0 -0
- legendkit-0.3.4/tests/test_colorbar.py +0 -0
- legendkit-0.3.4/tests/test_layout.py +0 -0
- legendkit-0.3.4/tests/test_legend.py +72 -0
- legendkit-0.3.2/pyproject.toml +0 -32
- legendkit-0.3.2/setup.py +0 -30
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_handlers.py +0 -0
- {legendkit-0.3.2 → legendkit-0.3.4}/legendkit/_register.py +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
Test_Installation:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
python-version: ['3.8', '3.9', '3.10', '3.11']
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
16
|
+
uses: actions/setup-python@v4
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python-version }}
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install --upgrade pip
|
|
22
|
+
pip install .[dev]
|
|
23
|
+
- name: Test with pytest
|
|
24
|
+
run: |
|
|
25
|
+
pip install pytest
|
|
26
|
+
pip install pytest-cov
|
|
27
|
+
pytest --cov=marsilea/ --cov-report=xml tests/
|
|
28
|
+
|
|
29
|
+
Upload_to_test_pypi:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v3
|
|
33
|
+
- name: Set up Python
|
|
34
|
+
uses: actions/setup-python@v4
|
|
35
|
+
with:
|
|
36
|
+
python-version: '3.10'
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install --upgrade pip
|
|
41
|
+
pip install flit
|
|
42
|
+
pip install .
|
|
43
|
+
|
|
44
|
+
- name: Publish to test.ipynb pypi
|
|
45
|
+
env:
|
|
46
|
+
FLIT_INDEX_URL: https://test.ipynb.pypi.org/legacy/
|
|
47
|
+
FLIT_USERNAME: __token__
|
|
48
|
+
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
49
|
+
run: flit publish || exit 0
|
|
50
|
+
|
|
51
|
+
- name: Publish to pypi
|
|
52
|
+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
|
|
53
|
+
env:
|
|
54
|
+
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
|
|
55
|
+
FLIT_USERNAME: __token__
|
|
56
|
+
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
57
|
+
run: flit publish
|
|
@@ -0,0 +1,163 @@
|
|
|
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
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
.idea/
|
|
161
|
+
notebooks/
|
|
162
|
+
|
|
163
|
+
.DS_Store
|
legendkit-0.3.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mr-Milk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: legendkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Legend creation and manipulation with ease for matplotlib
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Author-email: yb97643@um.edu.mo
|
|
9
|
-
Requires-Python: >=3.8,<4.0
|
|
10
|
-
Classifier: Framework :: Matplotlib
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
5
|
+
Author-email: Mr-Milk <yzheng@cemm.at>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
13
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
9
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier:
|
|
16
|
-
Classifier:
|
|
17
|
-
Classifier:
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Framework :: Matplotlib
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
19
13
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
|
-
Requires-Dist: matplotlib
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
Requires-Dist: matplotlib
|
|
15
|
+
Requires-Dist: ruff ; extra == "dev"
|
|
16
|
+
Requires-Dist: icecream ; extra == "dev"
|
|
17
|
+
Requires-Dist: python-hmr ; extra == "dev"
|
|
18
|
+
Requires-Dist: pytest ; extra == "dev"
|
|
19
|
+
Requires-Dist: scikit-learn ; extra == "dev"
|
|
20
|
+
Requires-Dist: sphinx ; extra == "dev"
|
|
21
|
+
Requires-Dist: numpydoc ; extra == "dev"
|
|
22
|
+
Requires-Dist: sphinx_gallery ; extra == "dev"
|
|
23
|
+
Requires-Dist: furo ; extra == "dev"
|
|
24
|
+
Requires-Dist: mpl_fontkit ; extra == "dev"
|
|
25
|
+
Project-URL: Home, https://github.com/Marsilea-viz/legendkit
|
|
26
|
+
Provides-Extra: dev
|
|
23
27
|
|
|
24
28
|
<p align="center">
|
|
25
29
|
<img src="https://raw.githubusercontent.com/Mr-Milk/legendkit/main/images/legendkit-project.svg">
|
|
@@ -31,7 +35,7 @@ Description-Content-Type: text/markdown
|
|
|
31
35
|
When you want to create or adjust the legend in matplotlib, things can get dirty.
|
|
32
36
|
Legendkit may solve your headache.
|
|
33
37
|
|
|
34
|
-
<img src="https://legendkit.readthedocs.io/en/latest/_images/cover.
|
|
38
|
+
<img src="https://legendkit.readthedocs.io/en/latest/_images/cover.png">
|
|
35
39
|
|
|
36
40
|
## Features
|
|
37
41
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
When you want to create or adjust the legend in matplotlib, things can get dirty.
|
|
9
9
|
Legendkit may solve your headache.
|
|
10
10
|
|
|
11
|
-
<img src="https://legendkit.readthedocs.io/en/latest/_images/cover.
|
|
11
|
+
<img src="https://legendkit.readthedocs.io/en/latest/_images/cover.png">
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
@@ -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,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
|
+
API/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from cycler import cycler
|
|
2
|
+
import legendkit
|
|
3
|
+
|
|
4
|
+
project = 'legendkit'
|
|
5
|
+
copyright = '2024, Mr-Milk'
|
|
6
|
+
author = 'Mr-Milk'
|
|
7
|
+
release = legendkit.__version__
|
|
8
|
+
|
|
9
|
+
extensions = [
|
|
10
|
+
'numpydoc',
|
|
11
|
+
'sphinx.ext.autodoc',
|
|
12
|
+
'sphinx.ext.autosummary',
|
|
13
|
+
'sphinx.ext.autosectionlabel',
|
|
14
|
+
'matplotlib.sphinxext.plot_directive',
|
|
15
|
+
'sphinx.ext.intersphinx',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
# Make sure the target is unique
|
|
19
|
+
autosectionlabel_prefix_document = True
|
|
20
|
+
|
|
21
|
+
# setting autosummary
|
|
22
|
+
autosummary_generate = True
|
|
23
|
+
autoclass_content = "class"
|
|
24
|
+
numpydoc_show_class_members = False
|
|
25
|
+
|
|
26
|
+
# setting plot directive
|
|
27
|
+
plot_include_source = True
|
|
28
|
+
plot_html_show_source_link = False
|
|
29
|
+
plot_html_show_formats = False
|
|
30
|
+
plot_formats = [('png', 200)]
|
|
31
|
+
plot_rcparams = {'savefig.bbox': 'tight',
|
|
32
|
+
'font.family': 'Lato',
|
|
33
|
+
'xtick.color': '.15',
|
|
34
|
+
'ytick.color': '.15',
|
|
35
|
+
'axes.axisbelow': True,
|
|
36
|
+
'grid.linestyle': '-',
|
|
37
|
+
'lines.solid_capstyle': 'round',
|
|
38
|
+
'axes.grid': True,
|
|
39
|
+
'axes.facecolor': 'EAEAF2',
|
|
40
|
+
'axes.edgecolor': 'white',
|
|
41
|
+
'axes.linewidth': 0,
|
|
42
|
+
'grid.color': 'white',
|
|
43
|
+
'xtick.major.size': 0,
|
|
44
|
+
'ytick.major.size': 0,
|
|
45
|
+
'xtick.minor.size': 0,
|
|
46
|
+
'ytick.minor.size': 0,
|
|
47
|
+
'axes.prop_cycle': cycler('color',
|
|
48
|
+
['#5A5B9F', '#D94F70', '#009473',
|
|
49
|
+
'#F0C05A', '#7BC4C4', '#FF6F61']),
|
|
50
|
+
'legend.borderpad': 0.,
|
|
51
|
+
'legend.labelspacing': 0.5,
|
|
52
|
+
'legend.handlelength': 1.0,
|
|
53
|
+
'legend.handleheight': 1.0,
|
|
54
|
+
'legend.handletextpad': 0.5,
|
|
55
|
+
'legend.borderaxespad': 0.5,
|
|
56
|
+
'legend.columnspacing': 1.0
|
|
57
|
+
}
|
|
58
|
+
plot_apply_rcparams = True
|
|
59
|
+
plot_pre_code = """
|
|
60
|
+
import numpy as np
|
|
61
|
+
from matplotlib import pyplot as plt
|
|
62
|
+
import mpl_fontkit as fk
|
|
63
|
+
|
|
64
|
+
fk.install("Lato")
|
|
65
|
+
np.random.seed(0)
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
templates_path = ['_templates']
|
|
70
|
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
71
|
+
|
|
72
|
+
html_theme = 'furo'
|
|
73
|
+
html_static_path = ['_static']
|
|
74
|
+
html_favicon = "../../images/legendkit-logo.svg"
|
|
75
|
+
|
|
76
|
+
intersphinx_mapping = {
|
|
77
|
+
'matplotlib': ('https://matplotlib.org/stable', None),
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def setup(app):
|
|
82
|
+
import legendkit as lk
|
|
83
|
+
# Trick sphinx that these APIs are not alias
|
|
84
|
+
lk.legend.__name__ = "legend"
|
|
85
|
+
lk.cat_legend.__name__ = "cat_legend"
|
|
86
|
+
lk.size_legend.__name__ = "size_legend"
|
|
87
|
+
lk.colorbar.__name__ = "colorbar"
|
|
88
|
+
lk.colorart.__name__ = "colorart"
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import matplotlib as mpl
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import numpy as np
|
|
4
|
+
from matplotlib.colors import Normalize
|
|
5
|
+
|
|
6
|
+
from legendkit import legend, cat_legend, colorbar, colorart, hstack, vstack, size_legend
|
|
7
|
+
|
|
8
|
+
mpl.rcParams['legend.handleheight'] = 1
|
|
9
|
+
mpl.rcParams['legend.handlelength'] = 1
|
|
10
|
+
mpl.rcParams['legend.labelspacing'] = .3
|
|
11
|
+
|
|
12
|
+
legend_items = [
|
|
13
|
+
('square', 'L1', {'color': "#e76f51"}),
|
|
14
|
+
('circle', 'L2', {'color': "#2a9d8f"}),
|
|
15
|
+
('triangle', 'L3', {'color': "#e9c46a"}),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
fig, ax = plt.subplots(figsize=(5.5, 6))
|
|
19
|
+
legend1 = legend(legend_items=legend_items,
|
|
20
|
+
title="Title Left",
|
|
21
|
+
alignment="left")
|
|
22
|
+
legend2 = legend(legend_items=legend_items,
|
|
23
|
+
title="Title Center",
|
|
24
|
+
alignment="center")
|
|
25
|
+
legend3 = legend(legend_items=legend_items,
|
|
26
|
+
title="Title Right",
|
|
27
|
+
alignment="right")
|
|
28
|
+
|
|
29
|
+
s1 = hstack([legend1, legend2, legend3], spacing=30,
|
|
30
|
+
title="Stack Horizontally")
|
|
31
|
+
|
|
32
|
+
legend1 = legend(legend_items=legend_items, title="Title Top",
|
|
33
|
+
title_loc="top", alignment="left")
|
|
34
|
+
legend2 = legend(legend_items=legend_items, title="Title Bottom",
|
|
35
|
+
title_loc="bottom", alignment="left")
|
|
36
|
+
legend3 = legend(legend_items=legend_items, title="Title Right",
|
|
37
|
+
title_loc="right", ncol=3)
|
|
38
|
+
legend4 = legend(legend_items=legend_items, title="Title Left",
|
|
39
|
+
title_loc="left", ncol=3)
|
|
40
|
+
|
|
41
|
+
hs = hstack([legend1, legend2], spacing=30)
|
|
42
|
+
vs = vstack([legend3, legend4], spacing=20)
|
|
43
|
+
|
|
44
|
+
s2 = vstack([hs, vs],
|
|
45
|
+
spacing=20, align="center",
|
|
46
|
+
title="Stack Vertically")
|
|
47
|
+
|
|
48
|
+
s3 = vstack([s1, s2], spacing=30, frameon=True, align="center",
|
|
49
|
+
loc="upper left",
|
|
50
|
+
title="Stack of Stacks of legends", ax=ax,
|
|
51
|
+
title_fontproperties={"fontsize": 14, "fontweight": 600,
|
|
52
|
+
"color": "#0089A7"})
|
|
53
|
+
|
|
54
|
+
norm = Normalize(vmin=0, vmax=10)
|
|
55
|
+
|
|
56
|
+
colorbar(ax=ax, norm=norm,
|
|
57
|
+
orientation="horizontal",
|
|
58
|
+
title="Colorbar", alignment="left",
|
|
59
|
+
loc="upper left", bbox_to_anchor=(1, 0.4),
|
|
60
|
+
bbox_transform=ax.transAxes)
|
|
61
|
+
|
|
62
|
+
colorbar(ax=ax, norm=norm,
|
|
63
|
+
orientation="horizontal",
|
|
64
|
+
shape="ellipse", cmap="RdBu",
|
|
65
|
+
title="Ellipse Colorbar", alignment="left",
|
|
66
|
+
loc="upper left", bbox_to_anchor=(1, 0.2),
|
|
67
|
+
bbox_transform=ax.transAxes)
|
|
68
|
+
|
|
69
|
+
colorbar(ax=ax, norm=norm,
|
|
70
|
+
orientation="horizontal",
|
|
71
|
+
shape="triangle", cmap="PuRd",
|
|
72
|
+
title="Triangle Colorbar", alignment="left",
|
|
73
|
+
loc="upper left", bbox_to_anchor=(1.4, 0.4),
|
|
74
|
+
bbox_transform=ax.transAxes)
|
|
75
|
+
|
|
76
|
+
colorbar(ax=ax, norm=norm,
|
|
77
|
+
orientation="horizontal",
|
|
78
|
+
shape="trapezoid", cmap="coolwarm",
|
|
79
|
+
title="Trapezoid Colorbar", alignment="left",
|
|
80
|
+
loc="upper left", bbox_to_anchor=(1.4, 0.2),
|
|
81
|
+
bbox_transform=ax.transAxes)
|
|
82
|
+
|
|
83
|
+
args = dict(
|
|
84
|
+
colors=["#A7D2CB", "#F2D388", "#A7D2CB", "#F2D388"],
|
|
85
|
+
labels=["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
86
|
+
)
|
|
87
|
+
legend1 = cat_legend(**args, title="Category", handle="circle")
|
|
88
|
+
legend2 = size_legend(sizes=np.arange(1, 401), title="Size", handle="circle")
|
|
89
|
+
cart = colorart(norm=norm, cmap="cool", ax=ax, title="Colorart")
|
|
90
|
+
hstack([legend1, legend2, cart], spacing=20, title="Stack colorbar and legend",
|
|
91
|
+
alignment="left",
|
|
92
|
+
loc="upper left", bbox_to_anchor=(1, 1), bbox_transform=ax.transAxes,
|
|
93
|
+
frameon=True, ax=ax, padding=2)
|
|
94
|
+
|
|
95
|
+
ax.set_axis_off()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.. legendkit documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Tue Aug 30 10:48:31 2022.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
Legendkit: Legend made easy for matplotlib
|
|
7
|
+
==========================================
|
|
8
|
+
|
|
9
|
+
.. image:: https://raw.githubusercontent.com/Mr-Milk/legendkit/main/images/legendkit-project.svg
|
|
10
|
+
|
|
11
|
+
When you want to create or adjust the legend in matplotlib,
|
|
12
|
+
things can get dirty.
|
|
13
|
+
Legendkit may solve your headache.
|
|
14
|
+
|
|
15
|
+
.. plot:: cover.py
|
|
16
|
+
:include-source: false
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Installation
|
|
20
|
+
------------
|
|
21
|
+
|
|
22
|
+
.. code-block:: shell
|
|
23
|
+
|
|
24
|
+
pip install legendkit
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
.. toctree::
|
|
28
|
+
:maxdepth: 1
|
|
29
|
+
:caption: Tutorial
|
|
30
|
+
:hidden:
|
|
31
|
+
|
|
32
|
+
tutorial/legend
|
|
33
|
+
tutorial/title&layout
|
|
34
|
+
tutorial/colorbar
|
|
35
|
+
tutorial/layout
|
|
36
|
+
tutorial/matplotlib_legend
|
|
37
|
+
|
|
38
|
+
.. toctree::
|
|
39
|
+
:maxdepth: 1
|
|
40
|
+
:caption: API
|
|
41
|
+
:hidden:
|
|
42
|
+
|
|
43
|
+
api.rst
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
text.color: .15
|
|
2
|
+
axes.labelcolor: .15
|
|
3
|
+
legend.frameon: False
|
|
4
|
+
legend.numpoints: 1
|
|
5
|
+
legend.scatterpoints: 1
|
|
6
|
+
xtick.direction: out
|
|
7
|
+
ytick.direction: out
|
|
8
|
+
xtick.color: .15
|
|
9
|
+
ytick.color: .15
|
|
10
|
+
axes.axisbelow: True
|
|
11
|
+
font.family: sans-serif
|
|
12
|
+
grid.linestyle: -
|
|
13
|
+
lines.solid_capstyle: round
|
|
14
|
+
|
|
15
|
+
# Seaborn darkgrid parameters
|
|
16
|
+
axes.grid: True
|
|
17
|
+
axes.facecolor: EAEAF2
|
|
18
|
+
axes.edgecolor: white
|
|
19
|
+
axes.linewidth: 0
|
|
20
|
+
grid.color: white
|
|
21
|
+
xtick.major.size: 0
|
|
22
|
+
ytick.major.size: 0
|
|
23
|
+
xtick.minor.size: 0
|
|
24
|
+
ytick.minor.size: 0
|
|
25
|
+
|
|
26
|
+
# Custom
|
|
27
|
+
axes.prop_cycle: cycler('color', ['7A76C2', 'ff6e9c98', 'f62196', '18c0c4', 'f3907e', '66E9EC'])
|
|
28
|
+
image.cmap: RdPu
|
|
29
|
+
|
|
30
|
+
figure.facecolor: fefeff
|
|
31
|
+
savefig.facecolor: fefeff
|
|
32
|
+
savefig.bbox: tight
|
|
33
|
+
|