Giter Club home page Giter Club logo

extensysplots's Introduction

Extensys Plots

DOI

Matplotlib extensys style for making figures This repo has Matplotlib Extensys style to format your figure for scientific publications and presentation.

Getting Started

The easist way to install ExtensysPlots is to use pip:

# to install the latest release (from PyPI) 
pip install ExtensysPlots

# in Ubuntu/Debian
python3 -m pip install extensysplots

# to install latest commit (from GitHub)
pip install git+https://github.com/mcekwonu/ExtensysPlots.git

The pip installation will automatically move all of the Matplotlib style files *.mplstyle into the appropriate directory on your computer.

Please see the FAQ section for more information and troubleshooting.

Using the Style

"extensys" 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('extensys')

Available styles include:

extensys, extensys-pl, extensys-gd, extensys-nb, extensys-sc

To use any of the styles temporarily, you can use:

with plt.style.context(['extensys']):
    plt.figure()
    plt.plot(x, y)
    plt.show()

The default format to save figure is .png with dpi=500. Other formats by obtained by passing it in the plt.savefig as well as the dpi. For example:

plt.savefig("figures/fig1" + ".pdf", dpi=1000)

Examples

The extensys style:

The extensys-ms style (with markers)

The extensys-gd style (with grid)

The extensys-nb style (with jupyter notebook)

The extensys + dark_background style

The extensys-sc style (with scatter)

The extensys-pl plain style

Plotting multiple left and right y-axis using extensys style

Help and Contribution

Please feel free to contribute to the ExtensysPlots repo! Before starting a new style or making any changes, please create an issue through the GitHub issue tracker.

If you need any help with ExtensysPlots, 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

  1. Installing ExtensysPlots manually

    • If you like, you can install the *.mplstyle files manually. 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())

      In my case it returned /home/mce/.config/matplotlib on Ubuntu and C:\Users\User\.matplotlib on Windows. Please verify the location of matplotib configdir as the location may differ for different users depending on how the matplotlib package was installed.

    • You should get back something like /home/mce/.config/matplotlib. You would then put the *.mplstyle files in /home/mce/.config/matplotlib/stylelib/ (you need to create the stylelib directory):

    • For Ubuntu

      cp styles/*.mplstyle ~/.config/matplotlib/stylelib/
    • For Windows

      cp styles/*.mplstyle ~/.matplotlib/stylelib/
  2. Using different fonts:

    • ExtensysPlots uses the default sans-serif font. If you would like to specify a different font, you can use:

      import matplotlib.pyplot as plt
      plt.style.use('extensys')
      plt.rcParams.update({
      "font.family": "serif",   # specify font family here
      "font.serif": ["Times"],  # specify font here
      "font.size":12})          # specify font size here
  3. Adjusting the legend placement:

    • You can adjust the legend borderpad when you have more than four legend parameters, for proper placement. You will need to try different values manually and see that it is placed correctly.
      import matplotlib.pyplot as plt
      plt.style.use('extensys')
      plt.rcParams.update({"legend.borderaxespad": -4.0})
  4. Installing ExtensysPlots within Google Colab, IPython, Jupyter Notebooks, etc.:

    • After installing ExtensysPlots within one of these environments, you may need to reload the Matplotlib style library. For example:

      !pip install ExtensysPlots
      import matplotlib.pyplot as plt
      plt.style.reload_library()
      plt.style.use('extensys')

ExtensysPlots in Academic Papers

The following papers used ExtensysPlots:

If you use ExtensysPlots in your paper/thesis, feel free to add it to the list!

Citation

You don't have to cite ExtensysPlots if you use it but it's nice if you do:

@article{ExtensysPlots,
    author    = {Michael Chukwuemeka Ekwonu},
    title     = {{mcekwonu/ExtensysPlots}},
    month     = {mar},
    year      = {2021},
    publisher = {},
    version   = {1.0.0},
    doi       = {10.5281/zenodo.4572436},
    url       = {https://doi.org/10.5281/zenodo.4572436}
}

License

MIT

extensysplots's People

Contributors

mcekwonu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

extensysplots's Issues

add style

extensys-pl style was added. And setup.py rewritten to install *.mplstyle files in right directory.

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.