add release figure genereation script
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,3 +24,4 @@ notebooks/color_spaces_manyview.ipynb
|
|||||||
notebooks/oklch_srgb_spherical.ipynb
|
notebooks/oklch_srgb_spherical.ipynb
|
||||||
notebooks/v1.4.0/
|
notebooks/v1.4.0/
|
||||||
notebooks/v1.5.1/
|
notebooks/v1.5.1/
|
||||||
|
CHECKLIST.md
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -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
|
Monotone curves have fixed chroma, whereas the accent curves' chroma varies
|
||||||
smoothly as a function of lightness within sRGB gamut bounds.
|
smoothly as a function of lightness within sRGB gamut bounds.
|
||||||
|
|
||||||
| Chroma curves | Color trajectories |
|
| Chroma curves | Color trajectories |
|
||||||
|-------------------------------------------------------|------------------------------------------|
|
|----------------------------------------------------------|------------------------------------------|
|
||||||
|  |  |
|
|  |  |
|
||||||
|
|
||||||
| Palette |
|
| Palette |
|
||||||
|--------------------------------|
|
|----------------------------------------------|
|
||||||
|  |
|
|  |
|
||||||
|
|
||||||
Chroma curves are designed specifically to establish a distinct role for each
|
Chroma curves are designed specifically to establish a distinct role for each
|
||||||
accent and are non-intersecting over the lightness domain (hence the distinct
|
accent and are non-intersecting over the lightness domain (hence the distinct
|
||||||
|
|||||||
BIN
images/release/1.5.1/chroma-bounds.png
Normal file
BIN
images/release/1.5.1/chroma-bounds.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
BIN
images/release/1.5.1/chroma-curves.png
Normal file
BIN
images/release/1.5.1/chroma-curves.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
images/release/1.5.1/palette-bare.png
Normal file
BIN
images/release/1.5.1/palette-bare.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
images/release/1.5.1/palette.png
Normal file
BIN
images/release/1.5.1/palette.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
@@ -1,9 +1,10 @@
|
|||||||
|
from importlib.metadata import version
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from coloraide import Color
|
from coloraide import Color
|
||||||
from matplotlib.collections import LineCollection
|
from matplotlib.collections import LineCollection
|
||||||
|
|
||||||
from importlib.metadata import version
|
|
||||||
from monobiome.palette import compute_hlc_map
|
from monobiome.palette import compute_hlc_map
|
||||||
from monobiome.constants import (
|
from monobiome.constants import (
|
||||||
h_map,
|
h_map,
|
||||||
@@ -11,13 +12,14 @@ from monobiome.constants import (
|
|||||||
L_points,
|
L_points,
|
||||||
accent_h_map,
|
accent_h_map,
|
||||||
monotone_h_map,
|
monotone_h_map,
|
||||||
max_Cstar_Horder,
|
|
||||||
Lspace_Cmax_Hmap,
|
Lspace_Cmax_Hmap,
|
||||||
|
max_Cstar_Horder,
|
||||||
Lpoints_Cstar_Hmap,
|
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 = {}
|
name_h_map = {}
|
||||||
ax_h_map = {}
|
ax_h_map = {}
|
||||||
fig, axes = plt.subplots(
|
fig, axes = plt.subplots(
|
||||||
@@ -66,11 +68,12 @@ def plot_hue_chroma_bounds() -> None:
|
|||||||
ncol=3
|
ncol=3
|
||||||
)
|
)
|
||||||
|
|
||||||
plt.suptitle("$C^*$ curves for hue groups")
|
plt.suptitle(f"$C^*$ curves for hue groups (v{VERSION})")
|
||||||
plt.show()
|
|
||||||
|
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))
|
fig, ax = plt.subplots(1, 1, figsize=(8, 6))
|
||||||
|
|
||||||
# uncomment to preview 5 core term colors
|
# uncomment to preview 5 core term colors
|
||||||
@@ -119,9 +122,9 @@ def plot_hue_chroma_star() -> None:
|
|||||||
ax.set_xlabel("Lightness (%)")
|
ax.set_xlabel("Lightness (%)")
|
||||||
ax.set_xticks([L_points[0], 45, 50, 55, 60, 65, 70, L_points[-1]])
|
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{VERSION})")
|
||||||
plt.suptitle(f"$C^*$ curves (v{mb_version})")
|
|
||||||
fig.show()
|
return fig, ax
|
||||||
|
|
||||||
|
|
||||||
def palette_image(
|
def palette_image(
|
||||||
|
|||||||
24
scripts/plots.py
Normal file
24
scripts/plots.py
Normal 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)
|
||||||
Reference in New Issue
Block a user