Skip to main content

Matplotlib template for SuperMongo style

Project description

smplotlib

DOI Downloads PyPI version License: MIT

Matplotlib template for SuperMongo (SM) style. Make your plots stylish and professional (and old-school) by one line of code.

Installation

pip install smplotlib

or

git clone
cd smplotlib
pip install -e . --user

Usage

import smplotlib

Then just use matplotlib.pyplot as usual. For a quick start, you can use smplotlib.demo_plot() to generate a figure with the default settings. This figure is inspired by the two-phase ISM figure in Prof. Bruce Draine's book, but the cooling curve doesn't correspond to the actual CR rates and ISRF.

example

More advanced usage

You can use the function smplotlib.set_style(fontweight='normal', usetex=False, fontsize=15, figsize=(6, 6), dpi=120) to customize the global seetings including font weight, font size, default figure size and resolution, and whether using LaTeX for math. The default font weight is 'normal', and the default setting for LaTeX is False. You can specify font weight as 'light' or 'heavy'. Current support for LaTeX is not quite satisfying, so it is recommended to set usetex=False.

You can turn off the black edgecolor of scatter plots by smplotlib.set_style(edgecolor='face'). This is useful when you want to plot a large number of points.

Hershey font

SuperMongo uses Hershey fonts. The ttf files are from a compilation by astronomer yangcht. Thanks for the great work!

There have been many efforts on translating the original Hershey font to modern formats, also see this and this. The font files in this repo still lack some characters, and the support for LaTeX and light weight fonts are not satisfying. If you have any suggestions, please feel free to open an issue or pull request.

Citation

If you find this package entertaining or useful, please consider citing it following the instructions in DOI.

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

smplotlib-0.0.9.tar.gz (430.5 kB view hashes)

Uploaded Source

Built Distribution

smplotlib-0.0.9-py3-none-any.whl (424.1 kB view hashes)

Uploaded Python 3

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