Science Plots
Matplotlib styles for scientific plotting
This repo has Matplotlib styles to format your plots for scientific papers, presentations and theses.
Installation
The easiest way to install SciencePlots is using pip:
# for latest commit
pip install git+https://github.com/garrettj403/SciencePlots.git
# for lastest release
pip install SciencePlots
The pip installation will automatically move all of the *.mplstyle files into the appropriate directory. Please see the FAQ for more information and troubleshooting.
Using the Styles
science.mplstyle is the main style from this repo. Whenever you want to use it, simply add the following to the top of your python script:
import matplotlib.pyplot as plt
plt.style.use('science')
You can also combine multiple styles together by:
plt.style.use(['science','ieee'])
In this case, the ieee style will override some of the parameters from the science style in order to configure the plot for IEEE papers (column width, fontsizes, etc.).
To use any of the styles temporarily, you can use:
with plt.style.context(['science', 'ieee']):
plt.figure()
plt.plot(x, y)
plt.show()
Examples
The science style:
The science + grid styles:
The science + ieee styles for IEEE papers:
- IEEE requires figures to be readable when printed in black and white. The
ieeestyle also sets the figure width to fit within one column of an IEEE paper.
The science + scatter styles for scatter plots:
The science + notebook styles for Jupyter notebooks:
You can also combine these styles with the other styles that come with Matplotlib. For example, the dark_background + science + high-vis styles:
Note: See the examples/ directory for more!
Color Blind Safe Color Cycles
The bright color cycle (7 colors):
The vibrant color cycle (7 colors):
The muted color cycle (10 colors):
The high-contrast color cycle (3 colors):
The light color cycle (9 colors):
Note: These color cycles are from Paul Tol's website.
Other Color Cycles
The high-vis color cycle:
The retro color cycle:
Help and Contributing
Please feel free to contribute to the SciencePlots repo! For example, it would be good to add new styles for different journals and add new color cycles. Before starting a new style or making any changes, please create an issue through the GitHub issue tracker. That way we can discuss if the changes are necessary and the best approach.
If you need any help with SciencePlots, please first check the FAQ and search through the previous GitHub issues. If you can't find an answer, create a new issue through the GitHub issue tracker.
You can checkout Matplotlib's documentation for more information on plotting settings.
FAQ
-
Errors related to Latex:
-
If you get an error saying
RuntimeError: Failed to process string with tex because latex could not be found, this means that you do not have Latex installed on your computer (or at least that Python/Matplotlib can't find it). You have two options: (1) install Latex, or (2) disable Latex using theno-latexoption:plt.style.use(['science','no-latex'])
-
For Windows users, you may need to manually add Latex to your environment path (see issue).
-
-
Manual installation:
-
If you like, you can install the
*.mplstylefiles manually. First, clone the repository and then copy all of the*.mplstylefiles into your Matplotlib style directory. If you're not sure where this is, in an interactive python console type:import matplotlib print(matplotlib.get_configdir())
You should get back something like
/home/garrett/.matplotlib. You would then put the*.mplstylefiles in/home/garrett/.matplotlib/stylelib/(you may need to create thestylelibdirectory). -
-
Installing SciencePlots within Google Colab, IPython, Jupyter Notebooks, etc.:
-
After installing SciencePlots within one of these environments, you may need to reload the Matplotlib style library. For example:
!pip install SciencePlots import matplotlib.pyplot as plt plt.style.reload_library() plt.style.use('science')
-
SciencePlots in Academic Papers
The following papers use SciencePlots:
-
H. Tian, et al., "ivis Dimensionality Reduction Framework for Biomacromolecular Simulations", J. Chem. Inf. Model., Aug 2020. (open access)
-
P. Stoltz, et al., "A new simple algorithm for space charge limited emission," Phys. Plasmas, vol. 27, no. 9, pp. 093103, Sep. 2020. (open access)
-
J. Garrett, et al., "A Nonlinear Transmission Line Model for Simulating Distributed SIS Frequency Multipliers," IEEE Trans. THz Sci. Technol., vol. 10, no. 3, pp. 246-255, May 2020. (open access)
-
J. Garrett, et al., "Simulating the Behavior of a 230 GHz SIS Mixer Using Multi-Tone Spectral Domain Analysis," IEEE Trans. THz Sci. Technol., vol. 9, no. 9, pp. 540-548, Nov. 2019. (open access)
-
J. Garrett, et al., "A Compact and Easy to Fabricate E-plane Waveguide Bend," IEEE Microw. Wireless Compon. Lett., vol. 29, no. 8, pp. 529-531, Aug. 2019. (open access)
-
J. Garrett, "A 230 GHz Focal Plane Array Using a Wide IF Bandwidth SIS Receiver," DPhil thesis, University of Oxford, Oxford, UK, 2018. (open access)
If you use SciencePlots in your paper/thesis, feel free to add it to the list!
Metadata
Release files for SciencePlots 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| SciencePlots-1.0.6.tar.gz | 7.0 kB | Without provenance | Details for SciencePlots-1.0.6.tar.gz |
Release files / SciencePlots-1.0.6.tar.gz
| Download URL | SciencePlots-1.0.6.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de7a70425a031242fd2b77bd7bb4e4bee66148ee0162922c44f7029cc850a508
|
|
BLAKE2b-256 checksum How to use checksums |
5232725f673acbc200a3015a766e84b91dc2c65a2b99260de78a806f290dc48c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.6
|
Security for SciencePlots 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.