def _plot_sensors(pos, colors, bads, ch_names, title, show_names, ax, show, select, block):
 import matplotlib.pyplot as plt
 from mpl_toolkits.mplot3d import Axes3D
 from .topomap import _check_outlines, _draw_outlines
 edgecolors = np.repeat('black', len(colors))
 edgecolors[bads] = 'red'
 if (ax is None):
  fig = plt.figure()
  if (pos.shape[1] == 3):
   Axes3D(fig)
   ax = fig.gca(projection='3d')
  else:
   ax = fig.add_subplot(111)
 else:
  fig = ax.get_figure()
 if (pos.shape[1] == 3):
  ax.text(0, 0, 0, '', zorder=1)
  ax.scatter(pos[:, 0], pos[:, 1], pos[:, 2], picker=True, c=colors, s=75, edgecolor=edgecolors, linewidth=2)
  ax.azim = 90
  ax.elev = 0
 else:
  ax.text(0, 0, '', zorder=1)
  ax.set_xticks([])
  ax.set_yticks([])
  fig.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None)
  (pos, outlines) = _check_outlines(pos, 'head')
  _draw_outlines(ax, outlines)
  pts = ax.scatter(pos[:, 0], pos[:, 1], picker=True, c=colors, s=75, edgecolor=edgecolors, linewidth=2)
  if select:
   fig.lasso = SelectFromCollection(ax, pts, ch_names)
 connect_picker = True
 if show_names:
  for idx in range(len(pos)):
   this_pos = pos[idx]
   if (pos.shape[1] == 3):
    ax.text(this_pos[0], this_pos[1], this_pos[2], ch_names[idx])
   else:
    ax.text(this_pos[0], this_pos[1], ch_names[idx])
  connect_picker = select
 if connect_picker:
  picker = partial(_onpick_sensor, fig=fig, ax=ax, pos=pos, ch_names=ch_names, show_names=show_names)
  fig.canvas.mpl_connect('pick_event', picker)
 fig.suptitle(title)
 closed = partial(_close_event, fig=fig)
 fig.canvas.mpl_connect('close_event', closed)
 plt_show(show, block=block)
 return fig

def _plot_sensors ( pos , colors , bads , ch_names , title , show_names , ax , show , select , block ) : import matplotlib . pyplot as plt from mpl_toolkits . mplot3d import Axes3D from . topomap import _check_outlines , _draw_outlines edgecolors = np . repeat ( 'black' , len ( colors ) ) edgecolors [ bads ] = 'red' if ( ax is None ) : fig = plt . figure ( ) if ( pos . shape [ 1 ] == 3 ) : Axes3D ( fig ) ax = fig . gca ( projection = '3d' ) else : ax = fig . add_subplot ( 111 ) else : fig = ax . get_figure ( ) if ( pos . shape [ 1 ] == 3 ) : ax . text ( 0 , 0 , 0 , '' , zorder = 1 ) ax . scatter ( pos [ : , 0 ] , pos [ : , 1 ] , pos [ : , 2 ] , picker = True , c = colors , s = 75 , edgecolor = edgecolors , linewidth = 2 ) ax . azim = 90 ax . elev = 0 else : ax . text ( 0 , 0 , '' , zorder = 1 ) ax . set_xticks ( [ ] ) ax . set_yticks ( [ ] ) fig . subplots_adjust ( left = 0 , bottom = 0 , right = 1 , top = 1 , wspace = None , hspace = None ) ( pos , outlines ) = _check_outlines ( pos , 'head' ) _draw_outlines ( ax , outlines ) pts = ax . scatter ( pos [ : , 0 ] , pos [ : , 1 ] , picker = True , c = colors , s = 75 , edgecolor = edgecolors , linewidth = 2 ) if select : fig . lasso = SelectFromCollection ( ax , pts , ch_names ) connect_picker = True if show_names : for idx in range ( len ( pos ) ) : this_pos = pos [ idx ] if ( pos . shape [ 1 ] == 3 ) : ax . text ( this_pos [ 0 ] , this_pos [ 1 ] , this_pos [ 2 ] , ch_names [ idx ] ) else : ax . text ( this_pos [ 0 ] , this_pos [ 1 ] , ch_names [ idx ] ) connect_picker = select if connect_picker : picker = partial ( _onpick_sensor , fig = fig , ax = ax , pos = pos , ch_names = ch_names , show_names = show_names ) fig . canvas . mpl_connect ( 'pick_event' , picker ) fig . suptitle ( title ) closed = partial ( _close_event , fig = fig ) fig . canvas . mpl_connect ( 'close_event' , closed ) plt_show ( show , block = block ) return fig
plot sensors .