Skip to main content

Matplotlib Extensys style format for scientific publications

Project description

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')

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)

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

    • 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):

      cp styles/*.mplstyle ~/.config/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

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

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

ExtensysPlots-1.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

ExtensysPlots-1.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file ExtensysPlots-1.0.2.tar.gz.

File metadata

  • Download URL: ExtensysPlots-1.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6

File hashes

Hashes for ExtensysPlots-1.0.2.tar.gz
Algorithm Hash digest
SHA256 caf9b65f6be3314a9509d453fcebcd0899b7bb2b397d2b0495e32550dbdca655
MD5 af8cab221edce349e9bec1ffa2da4ade
BLAKE2b-256 4d22bff0a9afc3115a13a8a313f7edcfe239288e76aa52c8bbcb8c3fc936a83d

See more details on using hashes here.

File details

Details for the file ExtensysPlots-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: ExtensysPlots-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.6

File hashes

Hashes for ExtensysPlots-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a81f5fe083fb59c046fc709d100ebb93107934aa880f8e7240bfed0e45b2b0d
MD5 9df598440d6afa45440c5ab04362c8c5
BLAKE2b-256 9658855d63e73c47f8c9a576aa8a6c5ca47047bc5bc1aef809895766dd73dfb4

See more details on using hashes here.

Supported by

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