@@ -802,7 +802,8 @@ def add_data(self, array, min=None, max=None, thresh=None,
802
802
colormap = "RdBu_r" , alpha = 1 ,
803
803
vertices = None , smoothing_steps = 20 , time = None ,
804
804
time_label = "time index=%d" , colorbar = True ,
805
- hemi = None , remove_existing = False , time_label_size = 14 ):
805
+ hemi = None , remove_existing = False , time_label_size = 14 ,
806
+ initial_time = None ):
806
807
"""Display data from a numpy array on the surface.
807
808
808
809
This provides a similar interface to add_overlay, but it displays
@@ -857,6 +858,8 @@ def add_data(self, array, min=None, max=None, thresh=None,
857
858
conserving memory when displaying different data in a loop.
858
859
time_label_size : int
859
860
Font size of the time label (default 14)
861
+ initial_time : float
862
+ Time initially shown in the plot.
860
863
"""
861
864
hemi = self ._check_hemi (hemi )
862
865
@@ -907,6 +910,12 @@ def add_data(self, array, min=None, max=None, thresh=None,
907
910
if not self .n_times == len (time ):
908
911
raise ValueError ('time is not the same length as '
909
912
'array.shape[1]' )
913
+ # initial time
914
+ if initial_time is None :
915
+ initial_time_index = None
916
+ else :
917
+ initial_time_index = self .index_for_time (initial_time )
918
+ # time label
910
919
if isinstance (time_label , string_types ):
911
920
time_label_fmt = time_label
912
921
@@ -919,6 +928,7 @@ def time_label(x):
919
928
else :
920
929
self ._times = None
921
930
self .n_times = None
931
+ initial_time_index = None
922
932
923
933
surfs = []
924
934
bars = []
@@ -938,6 +948,8 @@ def time_label(x):
938
948
name = "time_label" , row = row , col = col ,
939
949
font_size = time_label_size ,
940
950
justification = 'right' )
951
+ if initial_time_index is not None :
952
+ self .set_data_time_index (initial_time_index )
941
953
self ._toggle_render (True , views )
942
954
data ['surfaces' ] = surfs
943
955
data ['colorbars' ] = bars
0 commit comments