1

Ajouter la frise des top couleurs annuelles

This commit is contained in:
2025-12-03 15:28:53 +01:00
parent 1663a75461
commit 9bbebbd530
5 changed files with 84 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
import matplotlib
from pathlib import Path
from lib.plots.colors_timeline import plot_colors_heatmap, plot_translucent_share
from lib.plots.colors_timeline import plot_colors_heatmap, plot_top_colors_swatches, plot_translucent_share
matplotlib.use("Agg")
@@ -33,6 +33,7 @@ def test_plot_colors_heatmap(tmp_path: Path) -> None:
destination_linear = tmp_path / "figures" / "step15" / "colors_heatmap_linear.png"
destination_log = tmp_path / "figures" / "step15" / "colors_heatmap_log.png"
destination_share = tmp_path / "figures" / "step15" / "colors_heatmap_share.png"
destination_top = tmp_path / "figures" / "step15" / "colors_top5_swatches.png"
matrix_path.write_text(
"year,color_rgb,is_translucent,color_name,quantity_total\n"
"2020,AAAAAA,false,Gray,5\n"
@@ -44,6 +45,7 @@ def test_plot_colors_heatmap(tmp_path: Path) -> None:
plot_colors_heatmap(matrix_path, destination_linear, use_log_scale=False)
plot_colors_heatmap(matrix_path, destination_log, use_log_scale=True)
plot_colors_heatmap(matrix_path, destination_share, normalize_by_year=True)
plot_top_colors_swatches(matrix_path, destination_top, limit=2)
assert destination_linear.exists()
assert destination_linear.stat().st_size > 0
@@ -51,3 +53,5 @@ def test_plot_colors_heatmap(tmp_path: Path) -> None:
assert destination_log.stat().st_size > 0
assert destination_share.exists()
assert destination_share.stat().st_size > 0
assert destination_top.exists()
assert destination_top.stat().st_size > 0