Metadata-Version: 2.5
Name: lacort-plots
Version: 0.1.1
Summary: Brand tokens, colormaps and matplotlib figure style of Alberto Lacort: validated palette, journal typography profiles, multi-format export
Project-URL: Homepage, https://allabur.webs.upv.es
Author-email: Alberto Lacort <alberto.lacort@gmail.com>
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: matplotlib>=3.9
Description-Content-Type: text/markdown

# lacort-plots

One matplotlib style for every figure Alberto Lacort publishes. It fixes the typography (Palatino for the brand; Helvetica or Times for journal figures, all bundled as the free TeX Gyre clones), the colours (a six-hue categorical cycle validated for colour-vision deficiency, a sequential and a diverging ramp on Oxford Blue) and the export (PDF, SVG and PNG at 300 dpi from one call). The values come from the brand specification of the `allabur/brand` repository.

## Install

```bash
uv add lacort-plots
```

## Use

```python
import matplotlib.pyplot as plt

import lacort_plots

lacort_plots.apply_style()  # Palatino: thesis, slides, reports
lacort_plots.apply_style("journal")  # Helvetica: figures of a journal article

fig, ax = plt.subplots(figsize=lacort_plots.figure_size("text"))
ax.plot(x, observed, label="Observed")
ax.plot(x, simulated, label="Baseline")
ax.legend()
lacort_plots.save_figure(fig, "figures/weekly-census")
# -> weekly-census.pdf, weekly-census.svg, weekly-census.png
```

### Profiles

| Profile | Face | Use it for |
|---|---|---|
| `brand` (default) | TeX Gyre Pagella after the system Palatinos | Thesis, slides, group reports, posters |
| `journal` | TeX Gyre Heros, the free Helvetica | Figures of journal articles: Springer asks for Helvetica or Arial at 8-12 pt, Taylor & Francis for Times, Helvetica or Arial |
| `journal-serif` | TeX Gyre Termes, the free Times | Figures matching the body text of a Springer journal |

Journals re-typeset the text of an article but embed figures as supplied, so the face inside a figure is the one you choose.

### Colour by job

| Job | Token | Rule |
|---|---|---|
| Identity (one series, one hue) | `CYCLE` | Fixed order of six hues, Oxford Blue mid first, never cycled past the sixth. Already the property cycle. |
| Magnitude, parameter sweeps | `lacort-seq`, `sequential(n)` | One hue, light to dark. `sequential(5)` gives five ordered colours for five levels of a swept parameter. |
| Polarity (above or below a reference) | `lacort-div` | Oxford Blue and amber around a neutral centre. |
| State | `STATUS["success" / "warning" / "danger" / "info" / "neutral"]` | Reserved; never a series colour, never colour alone. |
| Text and axes | `INK`, `INK_SECONDARY`, `GRID` | Text wears ink, never a series colour. |

### Widths and formats

`figure_size("column")` is 84 mm, `figure_size("text")` 150 mm, `figure_size("wide")` 174 mm; the height follows the golden ratio unless `ratio` says otherwise. `save_figure` writes PDF, SVG and PNG at 300 dpi, with text kept as text (`pdf.fonttype` 42, `svg.fonttype` none). JPEG is not a default: lossy on lines and text. Poster figures: `apply_style(context="poster", size="a0")` and `poster_figsize(height_mm, size)`.

## Fonts

TeX Gyre Pagella, Heros and Termes (GUST Font License) and Inconsolata (SIL Open Font License) ship inside the package with their licences.
