The easiest way to install SciencePlots is using pip:
# for latest version pip install git+https://github.com/garrettj403/SciencePlots.git # for last release pip install SciencePlots
The pip installation will automatically 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:
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()