You've already forked etude_lego_jurassic_world
Ajoute l’étape 27 de palettes dominantes par set
This commit is contained in:
25
scripts/plot_set_color_swatches.py
Normal file
25
scripts/plot_set_color_swatches.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Trace la palette dominante de chaque set (hors minifigs)."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from lib.plots.set_color_swatches import plot_set_color_swatches
|
||||
from lib.rebrickable.set_color_swatches import build_top_colors_by_set, load_colors_by_set, load_sets_enriched, write_top_colors
|
||||
|
||||
|
||||
COLORS_BY_SET_PATH = Path("data/intermediate/colors_by_set.csv")
|
||||
SETS_ENRICHED_PATH = Path("data/intermediate/sets_enriched.csv")
|
||||
SWATCHES_PATH = Path("data/intermediate/set_color_swatches.csv")
|
||||
DESTINATION_PATH = Path("figures/step27/set_color_swatches.png")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Construit le CSV de top couleurs par set et trace le nuancier."""
|
||||
colors_rows = load_colors_by_set(COLORS_BY_SET_PATH)
|
||||
sets_lookup = load_sets_enriched(SETS_ENRICHED_PATH)
|
||||
swatches = build_top_colors_by_set(colors_rows, sets_lookup, top_n=5)
|
||||
write_top_colors(SWATCHES_PATH, swatches)
|
||||
plot_set_color_swatches(SWATCHES_PATH, DESTINATION_PATH)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user