@@ -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 :
@@ -82,7 +83,7 @@ def plot_spectra(freqs, power_spectra, log_freqs=False, log_powers=False, freq_r
8283
8384 ax .set_xlim (freq_range )
8485
85- style_spectrum_plot (ax , log_freqs , log_powers )
86+ style_spectrum_plot (ax , log_freqs , log_powers , grid )
8687
8788
8889# Alias `plot_spectrum` to `plot_spectra` for backwards compatibility
@@ -110,8 +111,9 @@ def plot_spectra_shading(freqs, power_spectra, shades, shade_colors='r',
110111 ax : matplotlib.Axes, optional
111112 Figure axes upon which to plot.
112113 **plot_kwargs
113- Additional plot related keyword arguments.
114- This can include additional inputs into :func:`~.plot_spectra`.
114+ Additional plot related keyword arguments, with styling options managed by ``style_plot``.
115+ For spectra plots, boolean input `grid` can be used to control if the figure has a grid.
116+ This can also include additional inputs into :func:`~.plot_spectra`.
115117
116118 Notes
117119 -----
@@ -127,7 +129,8 @@ def plot_spectra_shading(freqs, power_spectra, shades, shade_colors='r',
127129 add_shades (ax , shades , shade_colors , add_center , plot_kwargs .get ('log_freqs' , False ))
128130
129131 style_spectrum_plot (ax , plot_kwargs .get ('log_freqs' , False ),
130- plot_kwargs .get ('log_powers' , False ))
132+ plot_kwargs .get ('log_powers' , False ),
133+ plot_kwargs .get ('grid' , True ))
131134
132135
133136# Alias `plot_spectrum_shading` to `plot_spectra_shading` for backwards compatibility
@@ -165,13 +168,16 @@ def plot_spectra_yshade(freqs, power_spectra, shade='std', average='mean', scale
165168 ax : matplotlib.Axes, optional
166169 Figure axes upon which to plot.
167170 **plot_kwargs
168- Additional plot related keyword arguments.
171+ Additional plot related keyword arguments, with styling options managed by ``style_plot``.
172+ For spectra plots, boolean input `grid` can be used to control if the figure has a grid.
173+ This can also include additional inputs into :func:`~.plot_spectra`.
169174 """
170175
171176 if (isinstance (shade , str ) or isfunction (shade )) and power_spectra .ndim != 2 :
172177 raise ValueError ('Power spectra must be 2d if shade is not given.' )
173178
174179 ax = check_ax (ax , plot_kwargs .pop ('figsize' , PLT_FIGSIZES ['spectral' ]))
180+ grid = plot_kwargs .pop ('grid' , True )
175181
176182 # Set plot data & labels, logging if requested
177183 plt_freqs = np .log10 (freqs ) if log_freqs else freqs
@@ -208,4 +214,4 @@ def plot_spectra_yshade(freqs, power_spectra, shade='std', average='mean', scale
208214 ax .fill_between (plt_freqs , lower_shade , upper_shade ,
209215 alpha = alpha , color = color , ** plot_kwargs )
210216
211- style_spectrum_plot (ax , log_freqs , log_powers )
217+ style_spectrum_plot (ax , log_freqs , log_powers , grid )
0 commit comments