Installation

From PyPI

pip install plotastro

Betas (pre-releases) are opt-in: plain pip install gives you the latest stable version. When a beta newer than that is out, install it with:

pip install --pre plotastro
pip install --pre "plotastro[cmasher]"     # the beta with CMasher

The only hard dependency is matplotlib (≥ 3.5). plotastro works with both NumPy 1.x and 2.x — CI tests each — and with Python 3.9+. No LaTeX installation is required (LaTeX text rendering is optional, see Quickstart).

Optional: CMasher colours and colormaps

To use colours and colormaps from CMasher (see Colours), install it as well:

pip install "plotastro[cmasher]"     # or simply: pip install cmasher

plotastro imports CMasher only when you ask for a CMasher colour, so it is never needed otherwise. (Installing with conda? conda install -c conda-forge cmasher.)

From conda-forge

conda install -c conda-forge plotastro             # or: mamba install -c conda-forge plotastro
conda install -c conda-forge plotastro cmasher     # with CMasher

The conda-forge package needs Python 3.11 or newer (conda-forge’s current minimum); on older Pythons, install with pip instead.

From a clone

git clone https://github.com/BehnoodBandi/plotastro
cd plotastro
pip install -e ".[dev]"          # editable install + test dependencies (incl. CMasher)
pytest                           # optional: run the test suite

To run the examples and notebook from a clone:

pip install -r requirements-dev.txt

Styles only, no package

If you just want the .mplstyle files, copy them from src/plotastro/styles/ into your matplotlib configuration directory:

import matplotlib
print(matplotlib.get_configdir())   # copy the files into <this>/stylelib/

After that, plt.style.use("mnras") works in any script without plotastro installed. (With the package installed, this step is unnecessary — importing plotastro registers the styles automatically.)