Skip to content

Ellipse

Ellipse

Bases: DrawingObject

A class to create ellipses in the tikz environment.

The ellipse class handles ellipses in Tikz. It it analagous to the Tikz command

\draw[options] <center> ellipse (<x_radius> and <y_radius>);

Parameters:

Name Type Description Default
center Union[Tuple[float, float], Point]

Position of the center of the ellipse

required
x_axis float

The length (in cm) of the horizontal axis of the ellipse

required
y_axis float

The length (in cm) of the vertical axis of the ellipse

required
options str

TikZ options to draw with

''
action str

The type of TikZ action to use. Default is "draw"

'draw'

east property

east: Point

Returns the east point of the ellipse.

north property

north: Point

Returns the north point of the ellipse.

south property

south: Point

Returns the south point of the ellipse.

west property

west: Point

Returns the west point of the ellipse.

Example

Here we draw and ellipse and define the major and minors axes.

import tikzpy

tikz = tikzpy.TikzPicture()

# x,y axes
tikz.line((-5, 0), (5, 0), options="Gray!40, ->")
tikz.line((0, -5), (0, 5), options="Gray!40, ->")
# Ellipse
ellipse = tikz.ellipse(
    (0, 0), 4, 3, options="fill=ProcessBlue!70, opacity=0.4", action="filldraw"
)
# Labels
h_line = tikz.line((0, 0), (ellipse.x_axis, 0), options="thick, dashed, ->")
v_line = tikz.line((0, 0), (0, ellipse.y_axis), options="thick, dashed, ->")
tikz.node(h_line.midpoint, options="below", text="Major")
tikz.node(v_line.midpoint, options="left", text="Minor")