From eb494185e48738f0f58adda0e31fdc23feddc182 Mon Sep 17 00:00:00 2001 From: Alex Tate <0xalextate@gmail.com> Date: Thu, 1 Jun 2023 08:42:53 -0700 Subject: [PATCH 1/2] Bugfix: scatter_dge_class plots now retain proper alignment of the axes object so that the legend doesn't get clipped --- tiny/rna/plotterlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiny/rna/plotterlib.py b/tiny/rna/plotterlib.py index 6bef4819..cd4eef9e 100644 --- a/tiny/rna/plotterlib.py +++ b/tiny/rna/plotterlib.py @@ -719,7 +719,7 @@ def get(self) -> Tuple[plt.Figure, plt.Axes]: class ScatterCache(CacheBase): def __init__(self): - self.fig, self.ax = plt.subplots(figsize=(8, 8), tight_layout=False) + self.fig, self.ax = plt.subplots(figsize=(8, 8), layout="none") self.ax.set_aspect('equal') def get(self) -> Tuple[plt.Figure, plt.Axes]: From 2eb0f41ffabab6ea87546a65ea280e141306afae Mon Sep 17 00:00:00 2001 From: Alex Tate <0xalextate@gmail.com> Date: Thu, 1 Jun 2023 11:55:02 -0700 Subject: [PATCH 2/2] Additional fix. For some reason retrieving the cached figure causes it to "forget" the layout engine it should be using. There's likely an optimization opportunity here in our approach, but for now this restores the intended functionality --- tiny/rna/plotterlib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tiny/rna/plotterlib.py b/tiny/rna/plotterlib.py index cd4eef9e..d29c9361 100644 --- a/tiny/rna/plotterlib.py +++ b/tiny/rna/plotterlib.py @@ -726,4 +726,5 @@ def get(self) -> Tuple[plt.Figure, plt.Axes]: for group in self.ax.collections: group.remove() + self.fig.set_layout_engine('none') return self.fig, self.ax \ No newline at end of file