Commit 09230739 authored by Christian Brodbeck's avatar Christian Brodbeck Committed by Christian Brodbeck

ENH Brain.add_data(): argument for initial time index

parent 75daf555
......@@ -802,7 +802,8 @@ class Brain(object):
colormap="RdBu_r", alpha=1,
vertices=None, smoothing_steps=20, time=None,
time_label="time index=%d", colorbar=True,
hemi=None, remove_existing=False, time_label_size=14):
hemi=None, remove_existing=False, time_label_size=14,
initial_time=None):
"""Display data from a numpy array on the surface.
This provides a similar interface to add_overlay, but it displays
......@@ -857,6 +858,8 @@ class Brain(object):
conserving memory when displaying different data in a loop.
time_label_size : int
Font size of the time label (default 14)
initial_time : float
Time initially shown in the plot.
"""
hemi = self._check_hemi(hemi)
......@@ -907,6 +910,12 @@ class Brain(object):
if not self.n_times == len(time):
raise ValueError('time is not the same length as '
'array.shape[1]')
# initial time
if initial_time is None:
initial_time_index = None
else:
initial_time_index = self.index_for_time(initial_time)
# time label
if isinstance(time_label, string_types):
time_label_fmt = time_label
......@@ -919,6 +928,7 @@ class Brain(object):
else:
self._times = None
self.n_times = None
initial_time_index = None
surfs = []
bars = []
......@@ -938,6 +948,8 @@ class Brain(object):
name="time_label", row=row, col=col,
font_size=time_label_size,
justification='right')
if initial_time_index is not None:
self.set_data_time_index(initial_time_index)
self._toggle_render(True, views)
data['surfaces'] = surfs
data['colorbars'] = bars
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment