ellipse
Draws an ellipse for each data item. Like circle, but with independent width and height.
python
from gofish import ellipse
ellipse(w=24, h=30, fill="#e15759")Signature
python
ellipse(w=None, h=None, fill=None, stroke=None, stroke_width=None,
opacity=None, debug=None) -> MarkParameters
An ellipse. Box geometry via the shared dims channels; paint is a strict subset of paint (no filter).
| Option | Type | Default | Description |
|---|---|---|---|
fill | str | Fill color, or a field name for a color scale. | |
stroke | str | Stroke color. Defaults to fill. | |
stroke_width | float | 0 | Stroke width in pixels. |
opacity | float | 1 | Opacity, 0 to 1. |
aspect_ratio | float | w/h ratio to enforce. When both dims are data-driven, the constraining axis is used. | |
debug | bool | Dev-only flag: logs this mark's key and datum to the console as it is built. It changes nothing about what is drawn. |
Box dimensions
| Option | Type | Default | Description |
|---|---|---|---|
x | int | float | str | Left edge position. | |
cx | int | float | str | Center x. | |
x2 | int | float | str | Right edge position. | |
w | int | float | str | Width. | |
em_x | bool | Embed x in the parent's x space. | |
y | int | float | str | Start edge on y: the top edge where y reads top-down, the bottom edge where it grows upward. | |
cy | int | float | str | Center y. | |
y2 | int | float | str | Other y edge position. | |
h | int | float | str | Height. | |
em_y | bool | Embed y in the parent's y space. | |
dims | dict | Box dimensions by axis name: x/y, or a name the enclosing coordinate space declares (polar theta/r, geo lon/lat). Each value is a position (like x) or an interval {min, center, max, size, embedded}. |
Returns a Mark for use in .mark().
Examples
python
# Data-driven size
chart(data).flow(scatter(x="x", y="y")).mark(ellipse(w="width", h="height"))
# A circle is an ellipse with equal axes
ellipse(w=20, h=20, fill="#4e79a7")
# Translucent ellipse
ellipse(w=80, h=40, fill="coral", opacity=0.5)Notes
- Use
circlewhen width and height are always equal — its singleroption is simpler.
