-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] - Plotting updates #343
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
||
@savefig | ||
@style_plot | ||
def plot_autocorr(timepoints, autocorrs, labels=None, colors=None, ax=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only thought here is whether to include it in aperiodic.py or somewhere else, since acf isn't restricted to aperiodic signals.
... 'sim_bursty_oscillation' : {'freq': 10}}) | ||
>>> freqs1, powers1 = compute_spectrum(sig1, fs=500) | ||
>>> freqs2, powers2 = compute_spectrum(sig2, fs=500) | ||
>>> plot_spectra_3D([freqs1, freqs2], [powers1, powers2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the z-axis label is cutoff when I copy/paste the example into a notebook. I tried plt.tight_layout() but it gave an error about the size of the fig not having large enough margins. Maybe a solution would be to add an ax
or fig
kwarg
|
||
@savefig | ||
@style_plot | ||
def plot_spectra_3D(freqs, powers, log_freqs=False, log_powers=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added to __init__.py?
else: | ||
labels = repeat(labels) | ||
|
||
colors = repeat(colors) if not isinstance(colors, list) else cycle(colors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring for colors and labels says it accepts iterables, but this may break with tuple/array.
This PR updates and extends some plotting code. It adds to neurodsp some code I developed in the AperiodicHistory project, which I think are general enough to be added her.
Main updates:
prepare_multi_plot
which consolidates the same process we had in multiple places for supporting plots that may (or may not) have multiple inputs (e.g. plotting multiple spectra on the same plot)plot_autocorr
plotplot_spectra_3D
plot