def plot_spectrum_shading(freqs, power_spectrum, shades, add_center=False, ax=None, plot_style=style_spectrum_plot, **kwargs): """Plot a power spectrum with a shaded frequency region (or regions). Parameters ---------- freqs : 1d array X-axis data, frequency values. power_spectrum : 1d array Y-axis data, power values for spectrum to plot. shades : list of [float, float] or list of list of [float, float] Shaded region(s) to add to plot, defined as [lower_bound, upper_bound]. add_center : boolean, optional, default: False Whether to add a line at the center point of the shaded regions. ax : matplotlib.Axes, optional Figure axes upon which to plot. plot_style : callable, optional, default: style_spectrum_plot A function to call to apply styling & aesthetics to the plot. **kwargs Keyword arguments to be passed to the plot call. """ ax = check_ax(ax) plot_spectrum(freqs, power_spectrum, plot_style=None, ax=ax, **kwargs) add_shades(ax, shades, add_center, kwargs.get('log_freqs', False)) check_n_style(plot_style, ax, kwargs.get('log_freqs', False), kwargs.get('log_powers', False))
def plot_spectra_shading(freqs, power_spectra, shades, shade_colors='r', add_center=False, ax=None, plot_style=style_spectrum_plot, **plot_kwargs): """Plot a group of power spectra with a shaded frequency region (or regions). Parameters ---------- freqs : 2d array or 1d array or list of 1d array Frequency values, to be plotted on the x-axis. power_spectra : 2d array or list of 1d array Power values, to be plotted on the y-axis. shades : list of [float, float] or list of list of [float, float] Shaded region(s) to add to plot, defined as [lower_bound, upper_bound]. shade_colors : str or list of string Color(s) to plot shades. add_center : bool, optional, default: False Whether to add a line at the center point of the shaded regions. ax : matplotlib.Axes, optional Figure axes upon which to plot. plot_style : callable, optional, default: style_spectrum_plot A function to call to apply styling & aesthetics to the plot. **plot_kwargs Keyword arguments to be passed to `plot_spectra` or to the plot call. Notes ----- Parameters for `plot_spectra` can also be passed into this function as keyword arguments. This includes `log_freqs`, `log_powers` & `labels`. See `plot_spectra` for usage details. """ ax = check_ax(ax, plot_kwargs.pop('figsize', PLT_FIGSIZES['spectral'])) plot_spectra(freqs, power_spectra, ax=ax, plot_style=None, **plot_kwargs) add_shades(ax, shades, shade_colors, add_center, plot_kwargs.get('log_freqs', False)) check_n_style(plot_style, ax, plot_kwargs.get('log_freqs', False), plot_kwargs.get('log_powers', False))
def plot_spectrum_shading(freqs, power_spectrum, shades, add_center=False, ax=None, **kwargs): """Plot a power spectrum with a shaded frequency region (or regions). Parameters ---------- freqs : 1d array X-axis data, frequency values. power_spectrum : list of 1d array Y-axis data, power spectrum power values for spectrum to plot. shades : list of [float, float] or list of list of [float, float] Shaded region(s) to add to plot, defined as [lower_bound, upper_bound]. add_center : boolean Whether to add a line at the center point of the shaded regions. """ ax = check_ax(ax) plot_spectrum(freqs, power_spectrum, ax=ax, **kwargs) add_shades(ax, shades, add_center, kwargs.get('log_freqs', False))
def plot_spectra_shading(freqs, power_spectra, shades, add_center=False, ax=None, plot_style=style_spectrum_plot, **kwargs): """Plot a group of power spectra with a shaded frequency region (or regions). Parameters ---------- freqs : 2d array or 1d array or list of 1d array X-axis data, frequency values. power_spectra : 2d array or list of 1d array Y-axis data, power values for spectra to plot. shades : list of [float, float] or list of list of [float, float] Shaded region(s) to add to plot, defined as [lower_bound, upper_bound]. add_center : boolean, optional, default: False Whether to add a line at the center point of the shaded regions. ax : matplotlib.Axes, optional Figure axes upon which to plot. plot_style : callable, optional, default: style_spectrum_plot A function to call to apply styling & aesthetics to the plot. **kwargs Keyword arguments to be passed to plot_spectra or the plot call. Notes ----- Parameters for `plot_spectra` can also be passed into this function as **kwargs. This includes `log_freqs`, `log_powers` & `labels`. See `plot_spectra for usage details. """ ax = check_ax(ax) plot_spectra(freqs, power_spectra, ax=ax, plot_style=None, **kwargs) add_shades(ax, shades, add_center, kwargs.get('log_freqs', False)) check_n_style(plot_style, ax, kwargs.get('log_freqs', False), kwargs.get('log_powers', False))