From 13af350d63d0e03c62359d5cb29516bf08672f8b Mon Sep 17 00:00:00 2001 From: Pirmin Kaufmann Date: Wed, 3 Jul 2024 17:27:37 +0200 Subject: [PATCH 1/4] Change linecolors to sequence previously used with IDL. --- src/moveroplot/config/plot_settings.py | 18 ++++++++++-------- src/moveroplot/time_scores.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/moveroplot/config/plot_settings.py b/src/moveroplot/config/plot_settings.py index 6415fb0..cca538f 100644 --- a/src/moveroplot/config/plot_settings.py +++ b/src/moveroplot/config/plot_settings.py @@ -1,14 +1,16 @@ """Static configurations settings for plots.""" modelcolors: list[str] = [ - "black", - "red", - "blue", - "green", - "cyan", - "yellow", - "magenta", - "orange", + "tab:red", + "tab:blue", + "tab:orange", + "tab:green", + "tab:purple", + "tab:brown", + "tab:pink", + "tab:gray", + "tab:olive", + "tab:cyan", ] line_styles: list[str] = ["-", ":", "--", "-."] diff --git a/src/moveroplot/time_scores.py b/src/moveroplot/time_scores.py index b686023..564c8d0 100644 --- a/src/moveroplot/time_scores.py +++ b/src/moveroplot/time_scores.py @@ -122,7 +122,7 @@ def _initialize_plots(labels: list): nrows=2, ncols=1, tight_layout=True, figsize=(10, 10), dpi=200 ) custom_lines = [ - Line2D([0], [0], color=plot_settings.modelcolors[i], lw=2) + Line2D([0], [0], color=plot_settings.modelcolors[i % len(plot_settings.modelcolors)], lw=2) for i in range(len(labels)) ] fig.legend( From 1f98cf08c9508bdaefefb07a6e4ecb3ab9e10dcb Mon Sep 17 00:00:00 2001 From: Pirmin Kaufmann Date: Wed, 3 Jul 2024 17:28:33 +0200 Subject: [PATCH 2/4] Bump patch level. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9655552..41c6d22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "moveroplot" -version = "1.1.3" +version = "1.1.4" description = "Movero-plot" readme = "README.md" keywords = [ From f7c1d06516096ff5d6a67a001e751ac0117af608 Mon Sep 17 00:00:00 2001 From: Pirmin Kaufmann Date: Fri, 12 Jul 2024 12:23:33 +0200 Subject: [PATCH 3/4] Adapt formatting to match requirements of 'black'. --- src/moveroplot/time_scores.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/moveroplot/time_scores.py b/src/moveroplot/time_scores.py index 564c8d0..8884406 100644 --- a/src/moveroplot/time_scores.py +++ b/src/moveroplot/time_scores.py @@ -122,7 +122,12 @@ def _initialize_plots(labels: list): nrows=2, ncols=1, tight_layout=True, figsize=(10, 10), dpi=200 ) custom_lines = [ - Line2D([0], [0], color=plot_settings.modelcolors[i % len(plot_settings.modelcolors)], lw=2) + Line2D( + [0], + [0], + color=plot_settings.modelcolors[i % len(plot_settings.modelcolors)], + lw=2, + ) for i in range(len(labels)) ] fig.legend( From a1d22e8ccce83ee5db35dd75b62f1fc498d10840 Mon Sep 17 00:00:00 2001 From: Pirmin Kaufmann Date: Fri, 12 Jul 2024 17:04:32 +0200 Subject: [PATCH 4/4] Remove re-use of colors and issue error message instead. --- src/moveroplot/parse_inputs.py | 10 ++++++++++ src/moveroplot/time_scores.py | 7 +------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/moveroplot/parse_inputs.py b/src/moveroplot/parse_inputs.py index 1b5de50..527de1a 100644 --- a/src/moveroplot/parse_inputs.py +++ b/src/moveroplot/parse_inputs.py @@ -86,6 +86,16 @@ def _parse_inputs( """ ) plot_settings.modelcolors = color_list + else: + if len(all_model_versions) > len(plot_settings.modelcolors): + raise ValueError( + f""" + The number of model versions is larger than the + number of predefined colors for plotting + ({len(all_model_versions)} > {len(plot_settings.modelcolors)}) + """ + ) + plot_models_setup = [ model_combinations.split("/") for model_combinations in model_versions.split(",") diff --git a/src/moveroplot/time_scores.py b/src/moveroplot/time_scores.py index 8884406..b686023 100644 --- a/src/moveroplot/time_scores.py +++ b/src/moveroplot/time_scores.py @@ -122,12 +122,7 @@ def _initialize_plots(labels: list): nrows=2, ncols=1, tight_layout=True, figsize=(10, 10), dpi=200 ) custom_lines = [ - Line2D( - [0], - [0], - color=plot_settings.modelcolors[i % len(plot_settings.modelcolors)], - lw=2, - ) + Line2D([0], [0], color=plot_settings.modelcolors[i], lw=2) for i in range(len(labels)) ] fig.legend(