pygfx.materials.PointsMarkerMaterial

class pygfx.materials.PointsMarkerMaterial(*, marker='circle', edge_width=1, edge_color='black', custom_sdf=None, **kwargs)

Bases: PointsMaterial

A material to render points as markers.

Markers come in a variety of shapes, and have an edge with a separate color.

Parameters:
  • marker (str | MarkerShape) – The shape of the marker. Default ‘circle’.

  • edge_color (str | tuple | Color) – The color of line marking the edge of the markers. Default ‘black’.

  • edge_width (float) – The width of the edge of the markers. Default 1.

  • kwargs (Any) – Additional kwargs will be passed to the PointsMaterial.

property edge_color

The color of the edge of the markers.

property edge_color_is_transparent

Whether the edge_color is (semi) transparent (i.e. not fully opaque).

property edge_width

The width of the edge of the markers, in logical pixels (or world/model space if size_space is set).

property marker

The type/shape of the markers.

Supported values:

  • A string from pygfx.utils.enums.MarkerShape.

  • Matplotlib compatible characters: “osD+x^v<>”.

  • Unicode symbols: “●○■♦♥♠♣✳▲▼◀▶”.

  • Emojis: “❤️♠️♣️♦️💎💍✳️📍”.

  • A string containing the value “custom”. In this case, the WGSL code defined by custom_sdf will be used.

property custom_sdf

The SDF code for the marker shape when the marker is set to custom.

Negative values are inside the shape, positive values are outside the shape.

The SDF’s takes in two parameters coords: vec2<f32> and size: f32. The first is a WGSL coordinate and size is the overall size of the texture. The returned value should be the signed distance from any edge of the shape. Distances (positive and negative) that are less than half the edge_width in absolute terms will be colored with the edge_color. Other negative distances will be colored by color.