Skip to main content
`Ctrl`+`K`

# vispy.visuals.markers module

Marker Visual and shader definitions.

class vispy.visuals.markers.MarkersVisual(scaling='fixed', alpha=1, antialias=1, spherical=False, light_color='white', light_position=(1, -1, 1), light_ambient=0.3, method='points', **kwargs)

  Bases: `Visual`

  Visual displaying marker symbols.

  Parameters:
    pos array

      The array of locations to display each symbol.

    size float or array

      The symbol size in screen (or data, if scaling is on) px.

    edge_width float or array or None

      The width of the symbol outline in screen (or data, if scaling is on) px. Defaults to 1.0 if None or not provided and `edge_width_rel` is not provided.

    edge_width_rel float or array or None

      The width as a fraction of marker size. Can not be specified along with edge_width. A ValueError will be raised if both are provided.

    edge_color Color | ColorArray

      The color used to draw each symbol outline.

    face_color Color | ColorArray

      The color used to draw each symbol interior.

    symbol str or array

      The style of symbol used to draw each marker (see Notes).

    scaling str | bool

      Scaling method of individual markers. If set to “fixed” (default) then no scaling is done and markers will always be the same number of pixels on the screen. If set to “scene” then the chain of transforms from the Visual’s transform to the transform mapping to the OpenGL framebuffer are used to scaling the marker. This has the effect of the marker staying the same size in the “scene” coordinate space and changing size as the visualization is zoomed in and out. If set to “visual” the marker is scaled only using the transform of the Visual and not the rest of the scene/camera. This means that something like a camera changing the view will not affect the size of the marker, but the user can still scale it using the Visual’s transform. For backwards compatibility this can be set to the boolean `False` for “fixed” or `True` for “scene”.

    alpha float

      The opacity level of the visual.

    antialias float

      Antialiasing amount (in px).

    spherical bool

      Whether to add a spherical effect on the marker using lighting.

    light_color Color | ColorArray

      The color of the light used to create the spherical effect.

    light_position array

      The coordinates of the light used to create the spherical effect.

    light_ambient float

      The amount of ambient light used to create the spherical effect.

    method str

      Rendering method for markers. Options are:

      - ‘points’ (default): Use GL_POINTS primitive. Fast but may have platform-specific size limitations.

      - ‘instanced’: Use instanced rendering of quads. Works around point size limitations on some platforms.

  Notes

  Allowed style strings are: disc, arrow, ring, clobber, square, diamond, vbar, hbar, cross, tailed_arrow, x, triangle_up, triangle_down, and star.

  property alpha

    The opacity level of the visual.

  property antialias

    Antialiasing amount (in px).

  property canvas_size_limits

    Tuple of (min, max) size limits for markers in canvas pixels.

    If set, marker sizes will be clamped to this range. This is useful for preventing markers from becoming too large or too small when zooming with scene/visual scaling.

    Either min or max can be None to clamp only one side. Set to None to disable clamping entirely (default).

    Returns:
      tuple or None

        (min_size, max_size) or None if clamping is disabled.

  property light_ambient

    The amount of ambient light used to create the spherical effect.

  property light_color

    The color of the light used to create the spherical effect.

  property light_position

    The coordinates of the light used to create the spherical effect.

  property scaling

    If set to True, marker scales when rezooming.

  set_data(pos=None, size=10.0, edge_width=None, edge_width_rel=None, edge_color='black', face_color='white', symbol='o')

    Set the data used to display this visual.

    Parameters:
      pos array

        The array of locations to display each symbol.

      size float or array

        The symbol size in screen (or data, if scaling is on) px.

      edge_width float or array or None

        The width of the symbol outline in screen (or data, if scaling is on) px. Defaults to 1.0 if None or not provided and `edge_width_rel` is not

      provided.
      edge_width_rel float or array or None

        The width as a fraction of marker size. Can not be specified along with edge_width. A ValueError will be raised if both are provided.

      edge_color Color | ColorArray

        The color used to draw each symbol outline.

      face_color Color | ColorArray

        The color used to draw each symbol interior.

      symbol str or array

        The style of symbol used to draw each marker (see Notes).

  property spherical

    Whether to add a spherical effect on the marker using lighting.

  property symbol
  property symbols