From ffe2cd3c437fd385f80fed9e6abc6dc3013eff82 Mon Sep 17 00:00:00 2001 From: Philipp Weiler Date: Thu, 22 Feb 2024 10:22:25 +0100 Subject: [PATCH] Update `scatter` and `update_axes` (#1205) Add keyword `aspect` to set axis aspect. --- scvelo/plotting/scatter.py | 5 ++++- scvelo/plotting/utils.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scvelo/plotting/scatter.py b/scvelo/plotting/scatter.py index 2a8c2aa3..cd4c452a 100644 --- a/scvelo/plotting/scatter.py +++ b/scvelo/plotting/scatter.py @@ -119,6 +119,7 @@ def scatter( show=None, save=None, ax=None, + aspect="auto", **kwargs, ): """Scatter plot along observations or variables axes. @@ -770,7 +771,9 @@ def scatter( set_label(xlabel, ylabel, fontsize, basis, ax=ax) set_title(title, layer, color, fontsize, ax=ax) - update_axes(ax, xlim, ylim, fontsize, is_embedding, frameon, figsize) + update_axes( + ax, xlim, ylim, fontsize, is_embedding, frameon, figsize, aspect=aspect + ) if add_margin: set_margin(ax, x, y, add_margin) if colorbar is not False: diff --git a/scvelo/plotting/utils.py b/scvelo/plotting/utils.py index 0f59918f..fc432d85 100644 --- a/scvelo/plotting/utils.py +++ b/scvelo/plotting/utils.py @@ -466,6 +466,7 @@ def update_axes( is_embedding=False, frameon=None, figsize=None, + aspect="auto", ): """TODO.""" if xlim is not None: @@ -520,6 +521,8 @@ def update_axes( ax.tick_params(which="both", **kwargs) ax.set_frame_on(False) + ax.set_aspect(aspect) + if rcParams["savefig.transparent"]: ax.patch.set_alpha(0)