def plot_dipole_amplitudes(dipoles, colors=None, show=True):
 import matplotlib.pyplot as plt
 if (colors is None):
  colors = cycle(COLORS)
 (fig, ax) = plt.subplots(1, 1)
 xlim = [np.inf, (- np.inf)]
 for (dip, color) in zip(dipoles, colors):
  ax.plot(dip.times, dip.amplitude, color=color, linewidth=1.5)
  xlim[0] = min(xlim[0], dip.times[0])
  xlim[1] = max(xlim[1], dip.times[(-1)])
 ax.set_xlim(xlim)
 ax.set_xlabel('Time (sec)')
 ax.set_ylabel('Amplitude (nAm)')
 if show:
  fig.show(warn=False)
 return fig

def plot_dipole_amplitudes ( dipoles , colors = None , show = True ) : import matplotlib . pyplot as plt if ( colors is None ) : colors = cycle ( COLORS ) ( fig , ax ) = plt . subplots ( 1 , 1 ) xlim = [ np . inf , ( - np . inf ) ] for ( dip , color ) in zip ( dipoles , colors ) : ax . plot ( dip . times , dip . amplitude , color = color , linewidth = 1.5 ) xlim [ 0 ] = min ( xlim [ 0 ] , dip . times [ 0 ] ) xlim [ 1 ] = max ( xlim [ 1 ] , dip . times [ ( - 1 ) ] ) ax . set_xlim ( xlim ) ax . set_xlabel ( 'Time (sec)' ) ax . set_ylabel ( 'Amplitude (nAm)' ) if show : fig . show ( warn = False ) return fig
plot the amplitude traces of a set of dipoles .