From 632faad61df4dc2ee90cb6adf657daf7296aa366 Mon Sep 17 00:00:00 2001 From: Vinson Fan Date: Mon, 30 Oct 2023 17:04:44 +0800 Subject: [PATCH] improvements to temporal plot: lined up bottom plot with others, allowed use of subplot_extent as a parameter, also removed two unused imports for the file --- saspt/plot.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/saspt/plot.py b/saspt/plot.py index 5856e67..740c7c1 100644 --- a/saspt/plot.py +++ b/saspt/plot.py @@ -12,8 +12,6 @@ import os, sys, warnings, numpy as np, pandas as pd, matplotlib, \ matplotlib.pyplot as plt, matplotlib.gridspec as grd, seaborn as sns from typing import Tuple, List -from mpl_toolkits.axes_grid1 import make_axes_locatable -from matplotlib.cm import get_cmap from scipy.ndimage import gaussian_filter from .constants import TRACK, FRAME, PY, PX @@ -472,7 +470,6 @@ def norm(x): L = norm(L) # Plot layout - subplot_extent = (0, 6, 0, 1.5) figsize = (subplot_extent[1], subplot_extent[3]*3) fig, ax = plt.subplots(3, 1, figsize=figsize) @@ -523,8 +520,17 @@ def norm(x): if suptitle is not None: fig.suptitle(suptitle, fontsize=fontsize) - # Save plt.tight_layout() + + # Set bottom plot width to match top plots + heatmap_pos = ax[0].get_position() + lineplot_pos = ax[2].get_position() + ax[2].set_position([ + heatmap_pos.x0, lineplot_pos.y0, heatmap_pos.width, lineplot_pos.height + ]) + ax[2].set_xlim((0, n_blocks * frame_block_size)) + + # Save plt.savefig(out_png, dpi=600) plt.close()