@@ -161,7 +161,8 @@ def _layers(self):
161
161
def data (self ):
162
162
"""Return a pandas Series representing the profile."""
163
163
self ._check_sanity ()
164
- if self ._values .shape [1 ] == 2 :
164
+ iscompound = len (self ._values .shape ) > 1 and self ._values .shape [1 ] == 2
165
+ if iscompound :
165
166
columns = [f"{ self .modality } mean ({ self .unit } )" , "std" ]
166
167
else :
167
168
columns = [f"{ self .modality } ({ self .unit } )" ]
@@ -205,9 +206,13 @@ def plot(self, *args, backend="matplotlib", **kwargs):
205
206
kwargs ["title" ] = kwargs .get ("title" , "\n " .join (wrap (self .name , wrapwidth )))
206
207
layercolor = kwargs .pop ("layercolor" , "gray" )
207
208
208
- ymax = max (0 , self ._values .max () if self ._values .shape [1 ] == 1 else self ._values [:, 0 ].max () + self ._values [:, 1 ].max ())
209
+ iscompound = len (self ._values .shape ) > 1 and self ._values .shape [1 ] == 2
210
+ ymax = max (
211
+ 0 ,
212
+ sum (self ._values .max (axis = 0 )) if iscompound else self ._values .max ()
213
+ )
209
214
if backend == "matplotlib" :
210
- if self . _values . shape [ 1 ] == 2 :
215
+ if iscompound :
211
216
kwargs ["yerr" ] = kwargs .get ("yerr" , "std" )
212
217
kwargs ["xlabel" ] = kwargs .get ("xlabel" , "Cortical depth" )
213
218
kwargs ["ylabel" ] = kwargs .get ("ylabel" , self .unit )
@@ -231,7 +236,7 @@ def plot(self, *args, backend="matplotlib", **kwargs):
231
236
axs .set_title (axs .get_title (), fontsize = "medium" )
232
237
return axs
233
238
elif backend == "plotly" :
234
- if self . _values . shape [ 1 ] == 2 :
239
+ if iscompound :
235
240
kwargs ["error_y" ] = kwargs .get ("error_y" , "std" )
236
241
kwargs ["title" ] = kwargs ["title" ].replace ("\n " , "<br>" )
237
242
kwargs ["labels" ] = {
0 commit comments