Skip to content

Commit

Permalink
fixed pre-commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kaseylove committed Apr 15, 2024
1 parent 3b0284f commit 4fe1019
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rushd/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4fe1019

Please sign in to comment.