# vispy.plot.plotwidget module

class vispy.plot.plotwidget.PlotWidget(*args, **kwargs)

  Bases: `Widget`

  Widget to facilitate plotting

  Parameters:
    *args arguments

      Arguments passed to the ViewBox super class.

    **kwargs keywoard arguments

      Keyword arguments passed to the ViewBox super class.

  Notes

  This class is typically instantiated implicitly by a Figure instance, e.g., by doing `fig[0, 0]`.

  colorbar(cmap, position='right', label='', clim=('', ''), border_width=0.0, border_color='black', **kwargs)

    Show a ColorBar

    Parameters:
      cmap str | vispy.color.ColorMap

        Either the name of the ColorMap to be used from the standard set of names (refer to vispy.color.get_colormap), or a custom ColorMap object. The ColorMap is used to apply a gradient on the colorbar.

      position{‘left’, ‘right’, ‘top’, ‘bottom’}

        The position of the colorbar with respect to the plot. ‘top’ and ‘bottom’ are placed horizontally, while ‘left’ and ‘right’ are placed vertically

      label str

        The label that is to be drawn with the colorbar that provides information about the colorbar.

      clim tuple (min, max)

        the minimum and maximum values of the data that is given to the colorbar. This is used to draw the scale on the side of the colorbar.

      border_width float (in px)

        The width of the border the colormap should have. This measurement is given in pixels

      border_color str | vispy.color.Color

        The color of the border of the colormap. This can either be a str as the color’s name or an actual instace of a vipy.color.Color

    Returns:
      colorbar instance of ColorBarWidget

    See also

    `ColorBarWidget`
  histogram(data, bins=10, color='w', orientation='h')

    Calculate and show a histogram of data

    Parameters:
      data array-like

        Data to histogram. Currently only 1D data is supported.

      bins int | array-like

        Number of bins, or bin edges.

      color instance of Color

        Color of the histogram.

      orientation{‘h’, ‘v’}

        Orientation of the histogram.

    Returns:
      hist instance of Polygon

        The histogram polygon.

  image(data, cmap='cubehelix', clim='auto', fg_color=None, **kwargs)

    Show an image

    Parameters:
      data ndarray

        Should have shape (N, M), (N, M, 3) or (N, M, 4).

      cmap str

        Colormap name.

      clim str | tuple

        Colormap limits. Should be `'auto'` or a two-element tuple of min and max values.

      fg_color Color or None

        Sets the plot foreground color if specified.

      kwargs keyword arguments.

        More args to pass to `Image`.

    Returns:
      image instance of Image

        The image.

    Notes

    The colormap is only used if the image pixels are scalars.

  mesh(vertices=None, faces=None, vertex_colors=None, face_colors=None, color=(0.5, 0.5, 1.0), fname=None, meshdata=None, shading='auto')

    Show a 3D mesh

    Parameters:
      vertices array

        Vertices.

      faces array | None

        Face definitions.

      vertex_colors array | None

        Vertex colors.

      face_colors array | None

        Face colors.

      color instance of Color

        Color to use.

      fname str | None

        Filename to load. If not None, then vertices, faces, and meshdata must be None.

      meshdata MeshData | None

        Meshdata to use. If not None, then vertices, faces, and fname must be None.

      shading str

        Shading to use, can be None, ‘smooth’, ‘flat’, or ‘auto’. Default (‘auto’) will use None if face_colors is set, and ‘smooth’ otherwise.

    Returns:
      mesh instance of Mesh

        The mesh.

  plot(data, color='k', symbol=None, line_kind='-', width=1.0, marker_size=10.0, edge_color='k', face_color='b', edge_width=1.0, title=None, xlabel=None, ylabel=None, connect='strip')

    Plot a series of data using lines and markers

    Parameters:
      data array | two arrays

        Arguments can be passed as `(Y,)`, `(X, Y)` or `np.array((X, Y))`.

      color instance of Color

        Color of the line.

      symbol str

        Marker symbol to use.

      line_kind str

        Kind of line to draw. For now, only solid lines (`'-'`) are supported.

      width float

        Line width.

      marker_size float

        Marker size. If size == 0 markers will not be shown.

      edge_color instance of Color

        Color of the marker edge.

      face_color instance of Color

        Color of the marker face.

      edge_width float

        Edge width of the marker.

      title str | None

        The title string to be displayed above the plot

      xlabel str | None

        The label to display along the bottom axis

      ylabel str | None

        The label to display along the left axis.

      connect str | array

        Determines which vertices are connected by lines.

    Returns:
      line instance of LinePlot

        The line plot.

    See also

    `LinePlot`
  spectrogram(x, n_fft=256, step=None, fs=1.0, window='hann', normalize=False, color_scale='log', cmap='cubehelix', clim='auto')

    Calculate and show a spectrogram

    Parameters:
      x array-like

        1D signal to operate on. `If len(x) < n_fft`, x will be zero-padded to length `n_fft`.

      n_fft int

        Number of FFT points. Much faster for powers of two.

      step int | None

        Step size between calculations. If None, `n_fft // 2` will be used.

      fs float

        The sample rate of the data.

      window str | None

        Window function to use. Can be `'hann'` for Hann window, or None for no windowing.

      normalize bool

        Normalization of spectrogram values across frequencies.

      color_scale{‘linear’, ‘log’}

        Scale to apply to the result of the STFT. `'log'` will use `10 * log10(power)`.

      cmap str

        Colormap name.

      clim str | tuple

        Colormap limits. Should be `'auto'` or a two-element tuple of min and max values.

    Returns:
      spec instance of Spectrogram

        The spectrogram.

    See also

    `Image`
  surface(zdata, **kwargs)

    Show a 3D surface plot.

    Extra keyword arguments are passed to SurfacePlot().

    Parameters:
      zdata array-like

        A 2D array of the surface Z values.

  volume(vol, clim=None, method='mip', threshold=None, cmap='grays', **kwargs)

    Show a 3D volume

    Parameters:
      vol ndarray

        Volume to render.

      clim tuple of two floats | None

        The contrast limits. The values in the volume are mapped to black and white corresponding to these values. Default maps between min and max.

      method{‘mip’, ‘iso’, ‘translucent’, ‘additive’}

        The render style to use. See corresponding docs for details. Default ‘mip’.

      threshold float

        The threshold to use for the isosurafce render style. By default the mean of the given volume is used.

      cmap str

        The colormap to use.

      kwargs keyword arguments.

        More args to pass to `Volume`.

    Returns:
      volume instance of Volume

        The volume visualization.

    See also

    `Volume`

previous

vispy.plot.fig module

next

vispy.scene package