From 4fe1019a5b8fbc6bb5b7a34b03e7c1e8d2b4a914 Mon Sep 17 00:00:00 2001 From: Kasey Love Date: Mon, 15 Apr 2024 17:22:23 -0400 Subject: [PATCH] fixed pre-commit issues --- src/rushd/plot.py | 7 ++++--- tests/test_plot.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rushd/plot.py b/src/rushd/plot.py index 13597b7..c39ca14 100644 --- a/src/rushd/plot.py +++ b/src/rushd/plot.py @@ -236,16 +236,17 @@ def generate_xticklabels( ax_labels = [] for item in ax.get_xticklabels(): if item.get_text() in dict_labels_by_xticklabel: - + dict_labels = dict_labels_by_xticklabel[item.get_text()] # For each specified metadata key (label_cols), get the metadata value # and concatenate all values into separate lines of a single string new_xticklabel = "\n".join([str(dict_labels[i]) for i in label_cols]) ax_labels.append(new_xticklabel) - + # If the original label is not in the provided dictionary, leave as is - else: ax_labels.append(item.get_text()) + else: + ax_labels.append(item.get_text()) ax.set_xticks(ax.get_xticks(), ax_labels, multialignment=align_ticklabels) diff --git a/tests/test_plot.py b/tests/test_plot.py index f0d8d7b..0d6ac7b 100644 --- a/tests/test_plot.py +++ b/tests/test_plot.py @@ -149,6 +149,7 @@ def test_generate_xticklabels(): plt.close() assert new_labels == expected_labels + def test_xticklabels_subplots(): """Tests that plots with missing yticklabels don't throw an error""" df_labels = pd.DataFrame(