Coder Social home page Coder Social logo

scienceplots's Introduction

Science Plots

Format Matplotlib for scientific plotting

This repo has Matplotlib styles to format your plots for scientific papers, presentations and theses.

Installation

Put 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). If you're on macOS, you can run:

mkdir -p ~/.matplotlib/stylelib/
cp styles/*.mplstyle ~/.matplotlib/stylelib/
cp styles/misc/*.mplstyle ~/.matplotlib/stylelib/
cp styles/color/*.mplstyle ~/.matplotlib/stylelib/

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 + high-vis styles:

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 science + bright styles:

The science + vibrant styles:

The science + muted styles:

The science + retro styles:

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!

scienceplots's People

Contributors

garrettj403 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.