Installation

Requirements

  • Python ≥ 3.8

  • Matplotlib ≥ 3.4

  • PyYAML ≥ 5.3

From PyPI

The easiest way to install PubPlotLib is via pip:

pip install pubplotlib

From GitHub

To install the latest development version directly from GitHub:

git clone https://github.com/pier-astro/PubPlotLib.git
cd PubPlotLib
pip install .

For development, install with dev dependencies:

pip install -e ".[dev]"

Verifying Installation

To verify your installation, run:

import pubplotlib as pplt
print(pplt.available_styles())

You should see a list of available styles like ['aanda', 'apj', 'presentation'].

Font Requirements

Some styles may require specific fonts (e.g., Times New Roman). To check if all required fonts are available:

from pubplotlib.stylebuilder import check_fonts
check_fonts()

If fonts are missing, you can:

  1. Install them system-wide (varies by OS)

  2. Use the fonts provided in the fonts/ folder of the repository

  3. Update Matplotlib’s font cache:

python -c "import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)"

Or clear the cache and let Matplotlib rebuild it:

rm -rf ~/.cache/matplotlib

Troubleshooting

ImportError: No module named ‘pubplotlib’

Make sure you’re in the correct Python environment and that the package was installed:

pip list | grep pubplotlib

Matplotlib version too old

Update Matplotlib to version 3.4 or newer:

pip install --upgrade matplotlib

Font not found errors

See the “Font Requirements” section above.