@@ -47,13 +47,14 @@ def plot_spectra(freqs, power_spectra, log_freqs=False, log_powers=False, freq_r
4747 ax : matplotlib.Axes, optional
4848 Figure axes upon which to plot.
4949 **plot_kwargs
50- Additional plot related keyword arguments.
50+ Additional plot related keyword arguments, with styling options managed by ``style_plot``.
51+ For spectra plots, boolean input `grid` can be used to control if the figure has a grid.
5152 """
5253
54+ # Create the plot & collect plot kwargs of interest
5355 ax = check_ax (ax , plot_kwargs .pop ('figsize' , PLT_FIGSIZES ['spectral' ]))
54-
55- # Create the plot
5656 plot_kwargs = check_plot_kwargs (plot_kwargs , {'linewidth' : 2.0 })
57+ grid = plot_kwargs .pop ('grid' , True )
5758
5859 # Check for frequency range input, and log if x-axis is in log space
5960 if freq_range is not None :
@@ -83,7 +84,7 @@ def plot_spectra(freqs, power_spectra, log_freqs=False, log_powers=False, freq_r
8384
8485 ax .set_xlim (freq_range )
8586
86- style_spectrum_plot (ax , log_freqs , log_powers )
87+ style_spectrum_plot (ax , log_freqs , log_powers , grid )
8788
8889
8990# Alias `plot_spectrum` to `plot_spectra` for backwards compatibility
@@ -111,8 +112,9 @@ def plot_spectra_shading(freqs, power_spectra, shades, shade_colors='r',
111112 ax : matplotlib.Axes, optional
112113 Figure axes upon which to plot.
113114 **plot_kwargs
114- Additional plot related keyword arguments.
115- This can include additional inputs into :func:`~.plot_spectra`.
115+ Additional plot related keyword arguments, with styling options managed by ``style_plot``.
116+ For spectra plots, boolean input `grid` can be used to control if the figure has a grid.
117+ This can also include additional inputs into :func:`~.plot_spectra`.
116118
117119 Notes
118120 -----
@@ -128,7 +130,8 @@ def plot_spectra_shading(freqs, power_spectra, shades, shade_colors='r',
128130 add_shades (ax , shades , shade_colors , add_center , plot_kwargs .get ('log_freqs' , False ))
129131
130132 style_spectrum_plot (ax , plot_kwargs .get ('log_freqs' , False ),
131- plot_kwargs .get ('log_powers' , False ))
133+ plot_kwargs .get ('log_powers' , False ),
134+ plot_kwargs .get ('grid' , True ))
132135
133136
134137# Alias `plot_spectrum_shading` to `plot_spectra_shading` for backwards compatibility
@@ -166,13 +169,16 @@ def plot_spectra_yshade(freqs, power_spectra, shade='std', average='mean', scale
166169 ax : matplotlib.Axes, optional
167170 Figure axes upon which to plot.
168171 **plot_kwargs
169- Additional plot related keyword arguments.
172+ Additional plot related keyword arguments, with styling options managed by ``style_plot``.
173+ For spectra plots, boolean input `grid` can be used to control if the figure has a grid.
174+ This can also include additional inputs into :func:`~.plot_spectra`.
170175 """
171176
172177 if (isinstance (shade , str ) or isfunction (shade )) and power_spectra .ndim != 2 :
173178 raise ValueError ('Power spectra must be 2d if shade is not given.' )
174179
175180 ax = check_ax (ax , plot_kwargs .pop ('figsize' , PLT_FIGSIZES ['spectral' ]))
181+ grid = plot_kwargs .pop ('grid' , True )
176182
177183 # Set plot data & labels, logging if requested
178184 plt_freqs = np .log10 (freqs ) if log_freqs else freqs
@@ -209,4 +215,4 @@ def plot_spectra_yshade(freqs, power_spectra, shade='std', average='mean', scale
209215 ax .fill_between (plt_freqs , lower_shade , upper_shade ,
210216 alpha = alpha , color = color , ** plot_kwargs )
211217
212- style_spectrum_plot (ax , log_freqs , log_powers )
218+ style_spectrum_plot (ax , log_freqs , log_powers , grid )
0 commit comments