Skip to content

Commit 1d692ad

Browse files
committed
Doc updates on plts
1 parent 252b6f3 commit 1d692ad

File tree

6 files changed

+46
-26
lines changed

6 files changed

+46
-26
lines changed

fooof/plts/fg.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
"""Plots for FOOOFGroup object.
1+
"""Plots for the FOOOFGroup object.
22
33
Notes
44
-----
5-
This file contains plotting functions that take as input a FOOOFGroup() object.
5+
This file contains plotting functions that take as input a FOOOFGroup object.
66
"""
77

88
from fooof.core.io import fname, fpath
@@ -17,11 +17,11 @@
1717

1818
@check_dependency(plt, 'matplotlib')
1919
def plot_fg(fg, save_fig=False, file_name='FOOOF_group_fit', file_path=None):
20-
"""Plots a figure with subplots covering the group results from a FOOOFGroup object.
20+
"""Plots a figure with subplots covering the results from a FOOOFGroup object.
2121
2222
Parameters
2323
----------
24-
fg : FOOOFGroup() object
24+
fg : FOOOFGroup object
2525
FOOOFGroup object, containing results from fitting a group of power spectra.
2626
save_fig : boolean, optional, default: False
2727
Whether to save out a copy of the plot.
@@ -59,7 +59,7 @@ def plot_fg_ap(fg, ax=None):
5959
6060
Parameters
6161
----------
62-
fg : FOOOFGroup() object
62+
fg : FOOOFGroup object
6363
Group object from which to plot data.
6464
ax : matplotlib.Axes, optional
6565
Figure axes upon which to plot.
@@ -80,7 +80,7 @@ def plot_fg_gf(fg, ax=None):
8080
8181
Parameters
8282
----------
83-
fg : FOOOFGroup() object
83+
fg : FOOOFGroup object
8484
Group object from which to plot data.
8585
ax : matplotlib.Axes, optional
8686
Figure axes upon which to plot.
@@ -96,7 +96,7 @@ def plot_fg_peak_cens(fg, ax=None):
9696
9797
Parameters
9898
----------
99-
fg : FOOOFGroup() object
99+
fg : FOOOFGroup object
100100
Group object from which to plot data.
101101
ax : matplotlib.Axes, optional
102102
Figure axes upon which to plot.

fooof/plts/fm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
"""Plots for FOOOF object.
1+
"""Plots for the FOOOF object.
22
33
Notes
44
-----
5-
This file contains plotting functions that take as input a FOOOF() object.
5+
This file contains plotting functions that take as input a FOOOF object.
66
"""
77

88
import numpy as np
@@ -24,7 +24,7 @@ def plot_fm(fm, plt_log=False, save_fig=False, file_name='FOOOF_fit', file_path=
2424
2525
Parameters
2626
----------
27-
fm : FOOOF() object
27+
fm : FOOOF object
2828
FOOOF object, containing a power spectrum and (optionally) results from fitting.
2929
plt_log : boolean, optional, default: False
3030
Whether or not to plot the frequency axis in log space.
@@ -43,7 +43,7 @@ def plot_fm(fm, plt_log=False, save_fig=False, file_name='FOOOF_fit', file_path=
4343

4444
ax = check_ax(ax)
4545

46-
# Log Plot Settings - note that power values in FOOOF objects are already logged
46+
# Log settings. Note that power values in FOOOF objects are already logged
4747
log_freqs = plt_log
4848
log_powers = False
4949

@@ -69,7 +69,7 @@ def plot_peak_iter(fm):
6969
7070
Parameters
7171
----------
72-
fm : FOOOF() object
72+
fm : FOOOF object
7373
FOOOF object, with model fit, data and settings available.
7474
"""
7575

@@ -79,7 +79,7 @@ def plot_peak_iter(fm):
7979

8080
for ind in range(n_gauss + 1):
8181

82-
# Note: this forces to create a new plotting axes per iteration
82+
# This forces to create a new plotting axes per iteration
8383
ax = check_ax(None)
8484

8585
plot_spectrum(fm.freqs, flatspec, linewidth=2.0, label='Flattened Spectrum', ax=ax)

fooof/plts/spectra.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def plot_spectrum(freqs, power_spectrum, log_freqs=False, log_powers=False,
3232
power_spectrum : 1d array
3333
Y-axis data, power values for spectrum to plot.
3434
log_freqs : boolean, optional, default: False
35-
Whether or not to take the log of the power axis before plotting.
35+
Whether or not to take the log of the frequency axis before plotting.
3636
log_powers : boolean, optional, default: False
3737
Whether or not to take the log of the power axis before plotting.
3838
ax : matplotlib.Axes, optional
@@ -72,10 +72,11 @@ def plot_spectra(freqs, power_spectra, log_freqs=False, log_powers=False, labels
7272
power_spectra : 2d array or list of 1d array
7373
Y-axis data, power values for spectra to plot.
7474
log_freqs : boolean, optional, default: False
75-
Whether or not to take the log of the power axis before plotting.
75+
Whether or not to take the log of the frequency axis before plotting.
7676
log_powers : boolean, optional, default: False
7777
Whether or not to take the log of the power axis before plotting.
78-
labels " "
78+
labels : list of str, optional
79+
Legend labels, for each power spectrum.
7980
ax : matplotlib.Axes, optional
8081
Figure axes upon which to plot.
8182
plot_style : callable, optional, default: style_spectrum_plot

fooof/plts/style.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,32 @@
44
###################################################################################################
55

66
def check_n_style(style_func, *args):
7-
""""Check is a style function has been passed, and apply if so."""
7+
""""Check is a style function has been passed, and apply if so.
8+
9+
Parameters
10+
----------
11+
style_func : callable or None
12+
Function to apply styling to a plot axis.
13+
*args
14+
Inputs to the style plot.
15+
"""
816

917
if style_func:
1018
style_func(*args)
1119

1220

1321
def style_spectrum_plot(ax, log_freqs, log_powers):
14-
"""Define to styling for a power spectrum plot."""
22+
"""Define to styling for a power spectrum plot.
23+
24+
Parameters
25+
----------
26+
ax : matplotlib.Axes
27+
Figure axes to apply styling to
28+
log_freqs : boolean
29+
Whether the frequency axis is plotted in log space.
30+
log_powers : boolean
31+
Whether the power axis is plotted in log space.
32+
"""
1533

1634
# Get labels, based on log status
1735
xlabel = 'Frequency' if not log_freqs else 'log(Frequency)'

fooof/plts/templates.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Plot templates for the FOOOF module.
22
3-
Notes:
4-
- These are template plot structures used in reports and/or other plots.
5-
- They are not expected to be used / imported separately.
3+
Notes
4+
-----
5+
These are template plot structures for FOOOF plots and/or reports.
6+
They are not expected to be used directly by the user.
67
"""
78

89
import numpy as np
@@ -67,12 +68,12 @@ def plot_scatter_2(data_0, label_0, data_1, label_1, title=None, ax=None):
6768
data_0 : 1d array
6869
Data to plot on the first axis.
6970
label_0 : str
70-
Label for the data on the first axis, to be set as the y-axis label.
71+
Label for the data on the first axis, to be set as the axis label.
7172
data_1 : 1d array
7273
Data to plot on the second axis.
7374
label_0 : str
74-
Label for the data on the second axis, to be set as the y-axis label.
75-
title : str
75+
Label for the data on the second axis, to be set as the axis label.
76+
title : str, optional
7677
Title for the plot.
7778
ax : matplotlib.Axes, optional
7879
Figure axes upon which to plot.

fooof/plts/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Notes
44
-----
55
These utility functions should be considered private.
6-
They are not expected to be called directly by the user.
6+
They are not expected to be called directly by the user.
77
"""
88

99
from numpy import log10
@@ -26,7 +26,7 @@ def set_alpha(n_pts):
2626
2727
Returns
2828
-------
29-
n_pts : float
29+
alpha : float
3030
Value for alpha to use for plotting.
3131
"""
3232

0 commit comments

Comments
 (0)