ibllib.plots.misc

Functions

color_cycle

Gets the matplotlib color-cycle as RGB numpy array of floats between 0 and 1 :return:

spectrum

Display spectral density of a signal along a given dimension spectrum(w, fs)

squares

Matplotlib display of rising and falling fronts in a square-wave pattern

starplot

Function to create a star plot (also known as a spider plot, polar plot, or radar chart).

vertical_lines

From an x vector, draw separate vertical lines at each x location ranging from ymin to ymax

wiggle

Matplotlib display of wiggle traces

Classes

Density

Traces

wiggle(w, fs=1, gain=0.71, color='k', ax=None, fill=True, linewidth=0.5, t0=0, clip=2, sf=None, **kwargs)[source]

Matplotlib display of wiggle traces

Parameters:
  • w – 2D array (numpy array dimension nsamples, ntraces)

  • fs – sampling frequency

  • gain – display gain ; Note that if sf is given, gain is not used

  • color – (‘k’) color of traces

  • ax – (None) matplotlib axes object

  • fill – (True) fill variable area above 0

  • t0

    1. timestamp of the first sample

  • sf – scaling factor ; if None, uses the gain / SQRT of waveform RMS

Returns:

None

class Density(w, fs=30000, cmap='Greys_r', ax=None, taxis=0, title=None, gain=None, t0=0, unit='ms', **kwargs)[source]

Bases: object

on_key_press(event)[source]
class Traces(w, fs=1, gain=0.71, color='k', ax=None, linewidth=0.5, t0=0, **kwargs)[source]

Bases: object

on_key_press(event)[source]
squares(tscale, polarity, ax=None, yrange=[-1, 1], **kwargs)[source]

Matplotlib display of rising and falling fronts in a square-wave pattern

Parameters:
  • tscale – time of indices of fronts

  • polarity – polarity of front (1: rising, -1:falling)

  • ax – matplotlib axes object

Returns:

None

vertical_lines(x, ymin=0, ymax=1, ax=None, **kwargs)[source]

From an x vector, draw separate vertical lines at each x location ranging from ymin to ymax

Parameters:
  • x – numpy array vector of x values where to display lines

  • ymin – lower end of the lines (scalar)

  • ymax – higher end of the lines (scalar)

  • ax – (optional) matplotlib axis instance

Returns:

None

spectrum(w, fs, smooth=None, unwrap=True, axis=0, **kwargs)[source]

Display spectral density of a signal along a given dimension spectrum(w, fs)

Parameters:
  • w – signal

  • fs – sampling frequency (Hz)

  • smooth – (None) frequency samples to smooth over

  • unwrap – (True) unwraps the phase specrum

  • axis – axis on which to compute the FFT

  • kwargs – plot arguments to be passed to matplotlib

Returns:

matplotlib axes

color_cycle(ind=None)[source]

Gets the matplotlib color-cycle as RGB numpy array of floats between 0 and 1 :return:

starplot(labels, radii, ticks=None, ax=None, ylim=None, color=None, title=None)[source]

Function to create a star plot (also known as a spider plot, polar plot, or radar chart).

Parameters: labels (list): A list of labels for the variables to be plotted along the axes. radii (numpy array): The values to be plotted for each variable. ticks (numpy array, optional): A list of values to be used for the radial ticks.

If None, 5 ticks will be created between the minimum and maximum values of radii.

ax (matplotlib.axes._subplots.PolarAxesSubplot, optional): A polar axis object to plot on.

If None, a new figure and axis will be created.

ylim (tuple, optional): A tuple specifying the upper and lower limits of the y-axis.

If None, the limits will be set to the minimum and maximum values of radii.

color (str, optional): A string specifying the color of the plot.

If None, the color will be determined by the current matplotlib color cycle.

title (str, optional): A string specifying the title of the plot.

If None, no title will be displayed.

Returns: ax (matplotlib.axes._subplots.PolarAxesSubplot): The polar axis object containing the plot.