Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix legend position for pt.tl.Mixscape.plot_barplot #660

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pertpy/tools/_mixscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def plot_barplot( # pragma: no cover
axis_title_size: int = 8,
legend_title_size: int = 8,
legend_text_size: int = 8,
legend_bbox_to_anchor: tuple[float, float] = None,
show: bool = True,
return_fig: bool = False,
) -> Figure | None:
Expand All @@ -530,6 +531,12 @@ def plot_barplot( # pragma: no cover
guide_rna_column: The column of `.obs` with guide RNA labels. The target gene labels.
The format must be <gene_target>g<#>. Examples are 'STAT2g1' and 'ATF2g1'.
mixscape_class_global: The column of `.obs` with mixscape global classification result (perturbed, NP or NT).
axis_text_x_size: Size of the x-axis text.
axis_text_y_size: Size of the y-axis text.
axis_title_size: Size of the axis title.
legend_title_size: Size of the legend title.
legend_text_size: Size of the legend text.
legend_bbox_to_anchor: The bbox that the legend will be anchored.
{common_plot_args}

Returns:
Expand Down Expand Up @@ -593,9 +600,9 @@ def plot_barplot( # pragma: no cover
fig.subplots_adjust(right=0.8)
fig.subplots_adjust(hspace=0.5, wspace=0.5)
ax.legend(
title="mixscape_class_global",
title="Mixscape Class",
loc="center right",
bbox_to_anchor=(2.2, 3.5),
bbox_to_anchor=legend_bbox_to_anchor,
frameon=True,
fontsize=legend_text_size,
title_fontsize=legend_title_size,
Expand Down
Loading