@@ -38,23 +38,28 @@ def __init__(
3838
3939 def plot (self , mode = "activity" , ts = None , log = False ):
4040 """
41- Plotting method for actigraphy data.
41+ Plot a time series from actigraphy data.
42+
43+ This method generates an interactive Plotly graph of either activity, light, or
44+ a custom time series extracted from the dataframe stored in the Raw object. By default,
45+ it plots raw activity data.
4246
4347 Parameters
4448 ----------
4549 ts : str, optional
46- In case the user wants to plot a time series (ts) other than light or activity,
47- name of the vector to be used
48- mode : str
49- Either 'activity', 'light' or 'ts'. In case the user wants to plot a time series
50- other than light or activity.
50+ Name of the custom time series column to plot.
51+ mode : str, optional
52+ Type of data to plot. Must be one of:
53+ - 'activity': plot the activity signal
54+ - 'light': plot the light signal
55+ - None: plot custom signal (ts must not be None)
5156 log : bool
52- Whether or not to log data (log_{10] +1).
57+ Whether to apply a log transformation to the data (log10(x +1)) before plotting .
5358
5459 Returns
5560 -------
5661 go.Figure
57- Plot of activity or light data .
62+ A Plotly Figure object corresponding to a time series .
5863 """
5964 if ts is not None :
6065 mode = None
@@ -118,13 +123,15 @@ def plot(self, mode="activity", ts=None, log=False):
118123 showlegend = False ,
119124 )
120125 if log :
126+ # Draw log version of the time series
121127 return go .Figure (
122128 data = go .Scatter (
123129 x = self .df [ts ].index .astype (str ), y = np .log10 (self .df [ts ] + 1 )
124130 ),
125131 layout = layout ,
126132 )
127133 else :
134+ # Draw time series corresponding to the specified vector (ts)
128135 return go .Figure (
129136 data = go .Scatter (
130137 x = self .df [ts ].index .astype (str ), y = self .df [ts ]
0 commit comments