1
etude_lego_jurassic_world/scripts/plot_minifig_character_variations.py

29 lines
1.0 KiB
Python

"""Trace le total de minifigs et leurs variations distinctes par personnage."""
from pathlib import Path
from lib.plots.minifig_characters import plot_character_variations_vs_total
from lib.rebrickable.minifig_characters import (
aggregate_variations_and_totals,
load_minifigs_by_set,
write_character_variations_totals,
)
MINIFIGS_BY_SET_PATH = Path("data/intermediate/minifigs_by_set.csv")
COUNTS_PATH = Path("data/intermediate/minifig_character_variations_totals.csv")
DESTINATION_PATH = Path("figures/step22/minifig_character_variations_totals.png")
EXCLUDED_CHARACTERS = ["Figurant"]
def main() -> None:
"""Construit le comparatif variations/total et trace le graphique associé."""
rows = load_minifigs_by_set(MINIFIGS_BY_SET_PATH)
aggregates = aggregate_variations_and_totals(rows, excluded_characters=EXCLUDED_CHARACTERS)
write_character_variations_totals(COUNTS_PATH, aggregates)
plot_character_variations_vs_total(COUNTS_PATH, DESTINATION_PATH)
if __name__ == "__main__":
main()