Skip to main content

Format Matplotlib for scientific plotting

Project description

Science Plots

Format Matplotlib 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:

python -m pip install git+https://github.com/garrettj403/SciencePlots.git

This will move all of the *.mplstyle files into the appropriate directory. You can also do this manually, if you like. First, clone the repository and then copy all of the *.mplstyle files 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 *.mplstyle files in /home/garrett/.matplotlib/stylelib/ (you may need to create the stylelib directory).

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 main 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()

Contribution

Please feel free to add to this repo! For example, it would be good to add styles for different journals or perhaps new color cycles.

Examples

The science style:

The science + ieee styles:

IEEE requires figures to be readable when printed in black and white. The ieee style also sets the figure width to fit within one column of an IEEE paper.

The science + scatter styles:

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 Cycles

The high-vis color cycle:

The bright color cycle:

The vibrant color cycle:

The muted color cycle:

The retro color cycle:

Note: The bright, vibrant and muted styles are from Paul Tol's website (https://personal.sron.nl/~pault/). They are color-blind safe!

SciencePlots in Academic Papers

The following papers use SciencePlots:

Feel free to add your paper to the list if you use SciencePlots!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SciencePlots-1.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SciencePlots-1.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file SciencePlots-1.0.1.tar.gz.

File metadata

  • Download URL: SciencePlots-1.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0

File hashes

Hashes for SciencePlots-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c9a2dad64506ab76499141dfa9d1adc4b27fed68c9c40d84a4299a2db39cc1c3
MD5 ac937ce5e02d3b9583fe1c00d0e107db
BLAKE2b-256 e3e29f0234ae3575ecb13644fd9f9f6bd5b7ae69b3923745aaa0e154d7fb0720

See more details on using hashes here.

File details

Details for the file SciencePlots-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: SciencePlots-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0

File hashes

Hashes for SciencePlots-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 418fa0b2794efb84f0e58a82aae34f7a801b127ab94f1ad9d08586e4a09387bd
MD5 d9abe3737eb009a9735c8159e75043a1
BLAKE2b-256 457b6165d0f36d288a376e74d82849407b3c14c2b3bcfefd1594d70dde47285f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page