Repository: mne-tools/mne-python

Issue:
Green vertical line at t=0 in raw.plot
I was wondering what the vertical green line at t=0 indicates. This should be documented somewhere.
![screen shot 2017-11-22 at 12 23 33](https://user-images.githubusercontent.com/4377312/33125265-15a5cc62-cf80-11e7-9075-817f8fbde1c0.png)



Discussion:
I am not sure whether this line is of much use once we have annotations. It would be probably more useful to have topomap for specified time point pop up when one right-clicks the signal. This is one of the EEGlab functionalities that I still sometimes miss especially when teaching how to identitfy various artifacts in the signal.
So I take it that you don't know what this line means either 😄 ? I always thought it indicates a non-zero `first_samp`, but this is not true because my data starts at t=0 and `first_samp=0`. If it only indicates the start of the file (sample 0), I suggest we remove it because for me it was more confusing than helpful.
no idea :)

It was just a way to mark a time point. It's useful when you scroll left and right. It used to be (maybe still is?) that if you clicked in the plot somewhere not on a trace, it would move the green line there.
Thanks @larsoner, this makes sense. However, in a multichannel recording with lots of channels on a page it is almost impossible to click somewhere not on a trace, so practically it is impossible to move this line. I think a dedicated shortcut (e.g. Shift+Click) could solve this issue.
> I think a dedicated shortcut (e.g. Shift+Click) could solve this issue.

Sure, or make it possible (and document) that you can e.g. click along the x-axis labels to move the line, too.
This is even better. No need to introduce unnecessary shortcuts no one remembers. 👍 
@cbrnr can you take a look at implementing this in the next two weeks to make it into 0.17?
I thought it worked by right clicking, so there was no problem with clicking on channels but I may be wrong. Anyway it would be cool to be able to spawn topoplots for a time point, not only the green line via right-click.
Right-clicking seems like a good option. Currently, it doesn't work, maybe it used to and now it is broken?

Resolving patch:
diff --git a/mne/viz/raw.py b/mne/viz/raw.py
--- a/mne/viz/raw.py
+++ b/mne/viz/raw.py
@@ -29,7 +29,7 @@
                     _radio_clicked, _set_radio_button, _handle_topomap_bads,
                     _change_channel_group, _plot_annotations, _setup_butterfly,
                     _handle_decim, _setup_plot_projector, _check_cov,
-                    _set_ax_label_style)
+                    _set_ax_label_style, _draw_vert_line)
 from .evoked import _plot_lines
 
 
@@ -445,6 +445,7 @@ def plot_raw(raw, events=None, duration=10.0, start=0.0, n_channels=20,
     params['callback_key'] = callback_key
     # have to store this, or it could get garbage-collected
     params['opt_button'] = opt_button
+    params['update_vertline'] = partial(_draw_vert_line, params=params)
 
     # do initial plots
     callback_proj('none')
@@ -931,15 +932,14 @@ def _prepare_mne_browse_raw(params, title, bgcolor, color, bad_color, inds,
     ax_vscroll.set_title('Ch.')
 
     vertline_color = (0., 0.75, 0.)
-    params['ax_vertline'] = ax.plot([0, 0], ax.get_ylim(),
-                                    color=vertline_color, zorder=4)[0]
+    params['ax_vertline'] = ax.axvline(0, color=vertline_color, zorder=4)
     params['ax_vertline'].ch_name = ''
-    params['vertline_t'] = ax_hscroll.text(params['first_time'], 1, '',
-                                           color=vertline_color,
+    params['vertline_t'] = ax_hscroll.text(params['first_time'], 1.2, '',
+                                           color=vertline_color, fontsize=10,
                                            va='bottom', ha='right')
-    params['ax_hscroll_vertline'] = ax_hscroll.plot([0, 0], [0, 1],
-                                                    color=vertline_color,
-                                                    zorder=2)[0]
+    params['ax_hscroll_vertline'] = ax_hscroll.axvline(0,
+                                                       color=vertline_color,
+                                                       zorder=2)
     # make shells for plotting traces
     _setup_browser_offsets(params, n_channels)
     ax.set_xlim(params['t_start'], params['t_start'] + params['duration'],
diff --git a/mne/viz/utils.py b/mne/viz/utils.py
--- a/mne/viz/utils.py
+++ b/mne/viz/utils.py
@@ -906,20 +906,21 @@ def _mouse_click(event, params):
     """Handle mouse clicks."""
     if event.button not in (1, 3):
         return
-    if event.button == 3:
-        if params['fig_annotation'] is None:
+
+    if event.button == 3:  # right click
+        if params['fig_annotation'] is not None:  # annotation mode
+            raw = params['raw']
+            if any(c.contains(event)[0] for c in params['ax'].collections):
+                xdata = event.xdata - params['first_time']
+                onset = _sync_onset(raw, raw.annotations.onset)
+                ends = onset + raw.annotations.duration
+                ann_idx = np.where((xdata > onset) & (xdata < ends))[0]
+                raw.annotations.delete(ann_idx)  # only first one deleted
+            _remove_segment_line(params)
+            _plot_annotations(raw, params)
+            params['plot_fun']()
+        else:  # right click in browse mode does nothing
             return
-        raw = params['raw']
-        if np.any([c.contains(event)[0] for c in params['ax'].collections]):
-            xdata = event.xdata - params['first_time']
-            onset = _sync_onset(raw, raw.annotations.onset)
-            ends = onset + raw.annotations.duration
-            ann_idx = np.where((xdata > onset) & (xdata < ends))[0]
-            raw.annotations.delete(ann_idx)  # only first one deleted
-        _remove_segment_line(params)
-        _plot_annotations(raw, params)
-        params['plot_fun']()
-        return
 
     if event.inaxes is None:  # check if channel label is clicked
         if params['n_channels'] > 100:
@@ -985,9 +986,9 @@ def _find_channel_idx(ch_name, params):
 
 def _draw_vert_line(xdata, params):
     """Draw vertical line."""
-    params['ax_vertline'].set_data(xdata, np.array(params['ax'].get_ylim()))
-    params['ax_hscroll_vertline'].set_data(xdata, np.array([0., 1.]))
-    params['vertline_t'].set_text('%0.3f' % xdata[0])
+    params['ax_vertline'].set_xdata(xdata)
+    params['ax_hscroll_vertline'].set_xdata(xdata)
+    params['vertline_t'].set_text('%0.2f  ' % xdata)
 
 
 def _select_bads(event, params, bads):
@@ -995,7 +996,7 @@ def _select_bads(event, params, bads):
     # trade-off, avoid selecting more than one channel when drifts are present
     # however for clean data don't click on peaks but on flat segments
     if params['butterfly']:
-        _draw_vert_line(np.array([event.xdata] * 2), params)
+        _draw_vert_line(event.xdata, params)
         return bads
 
     def f(x, y):
@@ -1028,7 +1029,7 @@ def f(x, y):
                         params['ax_vscroll'].patches[idx].set_color(color)
                     break
     else:
-        _draw_vert_line(np.array([event.xdata] * 2), params)
+        _draw_vert_line(event.xdata, params)
 
     return bads
 
@@ -2014,9 +2015,6 @@ def drag_callback(x0):
             line = params['segment_line'].line
             pe = [Stroke(linewidth=4, foreground=color, alpha=0.5), Normal()]
             line.set_path_effects(pe if line.contains(event)[0] else pe[1:])
-            params['vertline_t'].set_text('%.3f' % x)
-            params['ax_vertline'].set_data(0,
-                                           np.array(params['ax'].get_ylim()))
             params['ax'].selector.active = False
             params['fig'].canvas.draw()
             return
@@ -2029,7 +2027,6 @@ def _remove_segment_line(params):
         params['segment_line'].remove()
         params['segment_line'] = None
         params['ax'].selector.active = True
-        params['vertline_t'].set_text('')
 
 
 def _annotation_modify(old_x, new_x, params):


Test patch: