Skip to content

Commit

Permalink
Merge pull request #102 from aertslab/dev
Browse files Browse the repository at this point in the history
ylim option in prediction plot
  • Loading branch information
nkempynck authored Jan 30, 2025
2 parents 223042f + 80c8b09 commit 0fd7458
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/crested/pl/bar/_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ def _check_input_params():
def prediction(
prediction: np.array,
classes: list,
ylabel="Prediction",
xlabel="Cell types",
title="Prediction plot",
ylabel: str = "Prediction",
xlabel: str = "Cell types",
title: str = "Prediction plot",
ylim: tuple(float, float) | None = None,
**kwargs,
) -> plt.Figure:
"""
Expand All @@ -203,6 +204,8 @@ def prediction(
Label for the x-axis. Default is 'cell types'.
title
Title of the plot. Default is 'Prediction plot'.
ylim
Manually set the y-axis limits.
kwargs
Additional keyword arguments to pass to `render_plot`.
Expand Down Expand Up @@ -230,6 +233,9 @@ def prediction(
ax.set_title(title)
ax.grid(True)

if ylim:
ax.set_ylim(ylim)

# Set the x-ticks to match the number of classes
ax.set_xticks(range(len(classes)))
ax.set_xticklabels(classes, rotation=45, ha="center")
Expand Down

0 comments on commit 0fd7458

Please sign in to comment.