Khriss
Khriss is a small Python utility for producing print-quality, correctly-sized figures for academic papers and books. Instead of guessing a figsize and fighting with LaTeX column widths afterwards, you ask Khriss for the exact dimensions a given journal (or book page) expects, in inches, and hand that straight to Matplotlib.
Currently supported targets:
- MNRAS (Monthly Notices of the Royal Astronomical Society)
- PASA (Publications of the Astronomical Society of Australia)
- Book layouts, including the A0–A5 series (portrait and landscape) and a generic A4 one-column/full-width size
This project is a work in progress — the API below is what's implemented today, with more journals and features planned.
Installation
Prerequisites
For best performance, you should install a TeX distribution (we recommend TeXLive) and the CMU fonts:
sudo apt install texlive
sudo apt install fonts-cmu
From PyPI
Once published, Khriss will be installable from PyPI:
pip install khriss
Until then, you can install it directly from GitHub:
pip install git+https://github.com/Krytic/khriss.git
Usage
khriss.get() returns a (width, height) tuple in inches, ready to pass to Matplotlib's figsize:
import matplotlib.pyplot as plt
import khriss
# A one-column MNRAS figure
figsize = khriss.get("mnras")
fig, ax = plt.subplots(figsize=figsize)
ax.plot([0, 1, 2], [0, 1, 4])
ax.set_xlabel("x")
ax.set_ylabel("y")
fig.savefig("figure.pdf", bbox_inches="tight")
Two-column and full-page variants are available via the columns argument:
onecol = khriss.get("mnras") # default
twocol = khriss.get("mnras", columns="twocol")
full = khriss.get("mnras", columns="full_page")
The same pattern works for "pasa". The "book" target additionally exposes the A-series page sizes:
khriss.get("book", columns="A4") # landscape A4
khriss.get("book", columns="PortraitA4")
khriss.get("book", columns="LandscapeA4")
khriss.get("book", columns="onecol_A4")
khriss.get("book", columns="A4_fullwidth")
Sizes are available for A0 through A5.
API
khriss.get(journal_name, columns=None, **kwargs)
journal_name(str) — one of"mnras","pasa", or"book"(case-insensitive).columns(str, optional) — which layout to return. Defaults to"onecol". Valid values depend onjournal_name; see above.**kwargs— forwarded to the underlying layout, e.g.aspect_ratioto override the default golden-ratio aspect ratio used to compute heights from widths.
Raises ValueError if journal_name isn't recognized.
Requirements
- Python >= 3.11
Contributing
Contributions are welcome — see CONTRIBUTING.md.
Citation
If Khriss is useful in your research, please consider citing it:
@software{khriss,
author = {Richards, Sean M.},
title = {Khriss: print-quality figures in Python},
url = {https://github.com/Krytic/khriss},
version = {1.0.0a},
}
(A DOI / Zenodo archive will be added here once one exists.)
License
Khriss is released under the MIT License.
Metadata
Release files for khriss 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| khriss-1.0.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| khriss-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / khriss-1.0.0.tar.gz
| Download URL | khriss-1.0.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e9c3b751d80e6625353c9e05ac5f37ca1e97e1b4483a505cc9b4be5ed49fcf0
|
|
BLAKE2b-256 checksum How to use checksums |
cf70766717a0cb067d552344de8f33e3fc7c50db6714436aae160435ba1a8df5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / khriss-1.0.0-py3-none-any.whl
| Download URL | khriss-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67200790a91e7b8a0f979572fef112e1beb09a1554f23e6884e3a63b3fb6fc5a
|
|
BLAKE2b-256 checksum How to use checksums |
437853a593adbc6f8fd6160a48b97a01feab9cda02b41aa92e978254df2ca627
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|