add release figure genereation script

This commit is contained in:
2026-01-16 16:13:28 -08:00
parent 356442395e
commit 99ed1c9557
8 changed files with 43 additions and 15 deletions

1
.gitignore vendored
View File

@@ -24,3 +24,4 @@ notebooks/color_spaces_manyview.ipynb
notebooks/oklch_srgb_spherical.ipynb
notebooks/v1.4.0/
notebooks/v1.5.1/
CHECKLIST.md

View File

@@ -30,13 +30,13 @@ both of which have fixed hue values and vary from 10% to 98% lightness.
Monotone curves have fixed chroma, whereas the accent curves' chroma varies
smoothly as a function of lightness within sRGB gamut bounds.
| Chroma curves | Color trajectories |
|-------------------------------------------------------|------------------------------------------|
| ![Chroma curves](images/curves/cstar-curves-v151.png) | ![Trajectories](images/trajectories.gif) |
| Chroma curves | Color trajectories |
|----------------------------------------------------------|------------------------------------------|
| ![Chroma curves](images/release/1.5.1/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
| Palette |
|--------------------------------|
| ![Palette](images/palette.png) |
| Palette |
|----------------------------------------------|
| ![Palette](images/release/1.5.1/palette.png) |
Chroma curves are designed specifically to establish a distinct role for each
accent and are non-intersecting over the lightness domain (hence the distinct

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -1,9 +1,10 @@
from importlib.metadata import version
import numpy as np
import matplotlib.pyplot as plt
from coloraide import Color
from matplotlib.collections import LineCollection
from importlib.metadata import version
from monobiome.palette import compute_hlc_map
from monobiome.constants import (
h_map,
@@ -11,13 +12,14 @@ from monobiome.constants import (
L_points,
accent_h_map,
monotone_h_map,
max_Cstar_Horder,
Lspace_Cmax_Hmap,
max_Cstar_Horder,
Lpoints_Cstar_Hmap,
)
VERSION = version("monobiome")
def plot_hue_chroma_bounds() -> None:
def plot_hue_chroma_bounds() -> tuple[plt.Figure, plt.Axes]:
name_h_map = {}
ax_h_map = {}
fig, axes = plt.subplots(
@@ -66,11 +68,12 @@ def plot_hue_chroma_bounds() -> None:
ncol=3
)
plt.suptitle("$C^*$ curves for hue groups")
plt.show()
plt.suptitle(f"$C^*$ curves for hue groups (v{VERSION})")
return fig, axes
def plot_hue_chroma_star() -> None:
def plot_hue_chroma_star() -> tuple[plt.Figure, plt.Axes]:
fig, ax = plt.subplots(1, 1, figsize=(8, 6))
# uncomment to preview 5 core term colors
@@ -119,9 +122,9 @@ def plot_hue_chroma_star() -> None:
ax.set_xlabel("Lightness (%)")
ax.set_xticks([L_points[0], 45, 50, 55, 60, 65, 70, L_points[-1]])
mb_version = version("monobiome")
plt.suptitle(f"$C^*$ curves (v{mb_version})")
fig.show()
plt.suptitle(f"$C^*$ curves (v{VERSION})")
return fig, ax
def palette_image(

24
scripts/plots.py Normal file
View File

@@ -0,0 +1,24 @@
from pathlib import Path
import monobiome as mb
from monobiome import plotting
from monobiome.palette import compute_hlc_map
figure_dir = Path(f"images/release/{mb.__version__}")
figure_dir.mkdir(parents=True, exist_ok=True)
fig, ax = plotting.plot_hue_chroma_bounds()
fig.savefig(Path(figure_dir, "chroma-bounds.png"))
fig, ax = plotting.plot_hue_chroma_star()
fig.savefig(Path(figure_dir, "chroma-curves.png"))
# compute the palette as hex to ensure the rendering matches; using
# "oklch" causes some slight hex drift when later using an eyedropper
hlc_map = compute_hlc_map("hex") # ("oklch")
fig, ax = plotting.show_palette(hlc_map)
fig.savefig(Path(figure_dir, "palette.png"))
fig, ax = plotting.show_palette(hlc_map, show_labels=False)
fig.savefig(Path(figure_dir, "palette-bare.png"), pad_inches=0)