Skip to content

Ellipse-Mark

The Plot.ellipse mark allows you to create ellipses or circles on your plot, with sizes that correspond to the x and y domains. This differs from Plot.dot, which specifies its radius in pixels.

An ellipse is defined by its center coordinates (x, y) and its radii. You can specify: - A single radius r for a circle (which may appear as an ellipse if the aspect ratio is not 1) - Separate rx and ry values for an ellipse with different horizontal and vertical radii - An optional rotation angle in degrees

In addition to the usual channel notation, data for ellipses can be provided as an array of arrays, each inner array in one of these formats: [x, y, r] [x, y, rx, ry] [x, y, rx, ry, rotation]

Here's an example demonstrating different ways to specify ellipses:

(
    Plot.ellipse(
        ellipse_data,
        {"fill": "red", "opacity": 0.5},
    )
    + Plot.domain([0, 7])
    + Plot.aspectRatio(1)
)

You can customize the appearance of ellipses using various options such as fill color, stroke, opacity, and more.

Here's another example using a list of objects to specify ellipses:

(
    Plot.ellipse(
        ellipse_object_data,
        {"x": "X", "y": "Y", "r": "SIZE", "opacity": 0.7, "fill": "purple"},
    )
    + Plot.domain([0, 4])
    + Plot.aspectRatio(1)
)