Skip to content

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) -> Mark

Parameters ​

An ellipse. Box geometry via the shared dims channels; paint is a strict subset of paint (no filter).

OptionTypeDefaultDescription
fillstrFill color, or a field name for a color scale.
strokestrStroke color. Defaults to fill.
stroke_widthfloat0Stroke width in pixels.
opacityfloat1Opacity, 0 to 1.
aspect_ratiofloatw/h ratio to enforce. When both dims are data-driven, the constraining axis is used.
debugboolDev-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 ​

OptionTypeDefaultDescription
xint | float | strLeft edge position.
cxint | float | strCenter x.
x2int | float | strRight edge position.
wint | float | strWidth.
em_xboolEmbed x in the parent's x space.
yint | float | strStart edge on y: the top edge where y reads top-down, the bottom edge where it grows upward.
cyint | float | strCenter y.
y2int | float | strOther y edge position.
hint | float | strHeight.
em_yboolEmbed y in the parent's y space.
dimsdictBox 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 circle when width and height are always equal — its single r option is simpler.