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
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'
|
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")