scistyles
Matplotlib stylesheets for scientific publications.
Installation
The package is available on pypi. Simply run:
pip install scistyles
Usage
The first purpose of this module is to supply matplotlib stylesheets to assist
in the creation of scientific figures. Since matplotlib 3.7.0, this has
become quite easy. This module is still useful to collect stylesheets.
The stylesheets stored under src/scistyles are discovered by matplotlib.
Simply use them:
import matplotlib.pyplot as plt
import scistyles
plt.style.use("scistyles.presentation-sp")
# plot away!
The module also provides a simple tool to format numbers with errors, such that the number in parentheses indicates the error on the last digits, ready to add to a plot.
from scistyles.format import format_value_error
l = format_value_error(3.14159265, 0.1234) # "3.14(12)"
# the number of decimals can be controlled:
l = format_value_error(3.14159265, 0.1234, nd=1) # "3.1(1)"
If you use lmfit, you can use them directly on the Parameter in the fit
results.
from scistyles.format import format_parameter
# get some data, setup some fit model.
result = model.fit(...)
label = format_parameter(result.params["important_variable"])
Contributing
Contributions are welcome! In case you have strong disagreement with our choice
of tick width or legend handlelength, then fine, just contribute your own
stylesheet. We won't argue1, and just add it to the pile. Simply make sure
to give the stylesheet a name that is not already taken.
To contribute a stylesheet, just write an issue. For large contributions, a PR would be appreciated.
See also
For everything about rcParams and stylesheets, see the official matplotlib
documentation.
TODO
- Add a test plot and autogenerated gallery.
- add a few further design tools (colors, palettes...)
- Figure a way to store misc info such as two-column figure width, preferred sublabel formats.
Notes
-
We aren't talking about colormaps. ↩
Release files for scistyles 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scistyles-1.2.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scistyles-1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 32.4 kB
Release files / scistyles-1.2.tar.gz
| Download URL | scistyles-1.2.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f74ebea78d7d603c5886199b5efa80e45b2de89f73d3d572d943f35e4e0cf10
|
|
BLAKE2b-256 checksum How to use checksums |
5923f3bc70c8e24e64198ee9ae6b143233d023cda6bbab628c3d493f8462aa3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / scistyles-1.2-py2.py3-none-any.whl
| Download URL | scistyles-1.2-py2.py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
36611ffbbd810d5ec76c410074e7fbad38484acdcf2dbe3ace27ee2123821373
|
|
BLAKE2b-256 checksum How to use checksums |
b9c7e7cded81da12d779e0671e7fe98861a4f9cce386a8dfc33b0a9ea62cbc03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|