AlexeyPechnikov / pygmtsar

PyGMTSAR (Python InSAR): Powerful and Accessible Satellite Interferometry
http://insar.dev/
BSD 3-Clause "New" or "Revised" License
364 stars 84 forks source link

[Bug]: Large stacks plotting too tight #88

Closed SteffanDavies closed 3 months ago

SteffanDavies commented 4 months ago

Alexey, I have become a Patreon supporter to support your work.

When plotting large stacks, the plot is too tight. I suggest altering plot width based on length of dates:

image

AlexeyPechnikov commented 4 months ago

Thanks. I'm surprised you didn't before because my articles and notebooks might be so helpful for your projects.

All the plots can be tuned using the common Matplotlib approach, such as:

plt.rcParams['figure.figsize'] = [12, 4]
plt.rcParams['figure.dpi'] = 300

In case you need to change a single plot only, a context manager helps to do it:

from contextlib import contextmanager
import matplotlib.pyplot as plt
@contextmanager
def mpl_settings(settings):
    original_settings = {k: plt.rcParams[k] for k in settings}
    plt.rcParams.update(settings)
    yield
    plt.rcParams.update(original_settings)

with mpl_settings({'figure.dpi': 300, 'figure.figsize': [12, 4]}):
    sbas.plot_baseline(baseline_pairs)

It's better to maintain smaller sizes for most of the plots to limit the notebook size.