def _plot_topo_onpick(event, show_func):
 orig_ax = event.inaxes
 if ((event.inaxes is None) or ((not hasattr(orig_ax, '_mne_ch_idx')) and (not hasattr(orig_ax, '_mne_axs')))):
  return
 import matplotlib.pyplot as plt
 try:
  if hasattr(orig_ax, '_mne_axs'):
   (x, y) = (event.xdata, event.ydata)
   for ax in orig_ax._mne_axs:
    if ((x >= ax.pos[0]) and (y >= ax.pos[1]) and (x <= (ax.pos[0] + ax.pos[2])) and (y <= (ax.pos[1] + ax.pos[3]))):
     orig_ax = ax
     break
   else:
    return
  ch_idx = orig_ax._mne_ch_idx
  face_color = orig_ax._mne_ax_face_color
  (fig, ax) = plt.subplots(1)
  plt.title(orig_ax._mne_ch_name)
  ax.set_axis_bgcolor(face_color)
  show_func(ax, ch_idx)
 except Exception as err:
  print(err)
  raise

def _plot_topo_onpick ( event , show_func ) : orig_ax = event . inaxes if ( ( event . inaxes is None ) or ( ( not hasattr ( orig_ax , '_mne_ch_idx' ) ) and ( not hasattr ( orig_ax , '_mne_axs' ) ) ) ) : return import matplotlib . pyplot as plt try : if hasattr ( orig_ax , '_mne_axs' ) : ( x , y ) = ( event . xdata , event . ydata ) for ax in orig_ax . _mne_axs : if ( ( x >= ax . pos [ 0 ] ) and ( y >= ax . pos [ 1 ] ) and ( x <= ( ax . pos [ 0 ] + ax . pos [ 2 ] ) ) and ( y <= ( ax . pos [ 1 ] + ax . pos [ 3 ] ) ) ) : orig_ax = ax break else : return ch_idx = orig_ax . _mne_ch_idx face_color = orig_ax . _mne_ax_face_color ( fig , ax ) = plt . subplots ( 1 ) plt . title ( orig_ax . _mne_ch_name ) ax . set_axis_bgcolor ( face_color ) show_func ( ax , ch_idx ) except Exception as err : print ( err ) raise
onpick callback that shows a single channel in a new figure .