scikit-maad/scikit-maad

Example subplots

Closed this issue · 1 comments

Examples with subplots and axis management do not work correctly, the function only plots a single axis.

image

Hi Sebastián,

This unexpected behavior of the plotting functions is due to a default parameter for the functions maad.util.plot1d and maad.util.plot2d. These functions have as a **kwargs parameters the option now=True, which facilitates the display of plots when using an Interactive Python console. To reproduce this plot add the argument now=False and add at the end plt.show():

fig, ax = plt.subplots(4,1, figsize=(8,10))
util.plot_wave(s_trim, fs, ax=ax[0], now=False)
util.plot_wave(env, fs, ax=ax[1], now=False)
util.plot_spectrum(pxx, fidx, ax=ax[2], now=False)
util.plot_spectrogram(Sxx, extent=ext, ax=ax[3], colorbar=False, now=False)
plt.show()