10.13 The ellipse command

Ellipses may be placed on multiplot canvases using the ellipse command. The shape of the ellipse may be specified in many different ways, by specifying

beginenumerate the position of two corners of the smallest rectangle which can enclose the ellipse when its major axis is horizontal, together with an optional counter-clockwise rotation angle, applied about the centre of the ellipse. For example:

ellipse from 0,0 to 4,1 rot 70

the position of both the centre and one of the foci of the ellipse, together with any one of the following additional pieces of information: the ellipse’s major axis length, its semi-major axis length, its minor axis length, its semi-minor axis length, its eccentricity, its latus rectum, or its semi-latus rectum. For example:

ellipse focus 0,0 centre 2,2 majoraxis 4
ellipse focus 0,0 centre 2,2 minoraxis 4
ellipse focus 0,0 centre 2,2 ecc 0.5
ellipse focus 0,0 centre 2,2 LatusRectum 6
ellipse focus 0,0 centre 2,2 slr 3

the position of either the centre or one of the foci of the ellipse, together with any two of the following additional pieces of information: the ellipse’s major axis length, its semi-major axis length, its minor axis length, its semi-minor axis length, its eccentricity, its latus rectum, or its semi-latus rectum. An optional counter-clockwise rotation angle may also be specified, applied about either the centre or one of the foci of the ellipse, whichever is specified. If no rotation angle is given, then the major axis of the ellipse is horizontal. For example:

ellipse centre 0,0 majoraxis 4 minoraxis 4

The line type, line width, and color of line with which the outlines of ellipses are drawn may be specified after the keyword with, as in the box and circle commands above. Likewise, ellipses may be filled in the same manner.


Example: A labelled diagram of an ellipse

In this example script, we illustrate the text of Section 10.13 by using Pyxplot’s ellipse command, together with arrows and text labels, to produce a labelled diagram of an ellipse. We label the semi-major axis $a$, the semi-minor axis $b$, the semi-latus rectum $L$, and the distance between the centre of the ellipse and one of its foci with the length $ae$, where $e$ is the eccentricity of the ellipse.
set multiplot ; set nodisplay

a   = 6.0              # Semi-major axis
b   = 4.0              # Semi-minor axis
e   = sqrt(1-(b/a)**2) # Eccentricity
slr = a*(1-e**2)       # Length of semi-latus rectum
fd  = a*e              # Distance of focus from center

# Draw ellipse
ellipse center 0,0 semiMajor a semiMinor b with lw 3

# Draw points at center and focus
set texthalign center ; set textvalign top
set fontsize 1.5
point at 0,0 label "Centre" with pointsize 2 plw 2
point at -fd,0 label "Focus" with pointsize 2 plw 2

# Draw arrows and dotted lines on ellipse
arrow from 0,0 to 0,b with twohead lw 2 lt 3   # Semi-minor axis
arrow from 0,0 to a,0 with twohead lw 2 lt 3   # Semi-major axis
arrow from -fd,0 to -fd,slr with tw lw 2 lt 3  # SLR
arrow from 0,0 to -fd,0 with twohead lw 2 lt 3 # Focus $<$-$>$ Centre

# Label ellipse
set texthalign center ; set textvalign center
text ’$ae$’ at -fd/2,-0.3
text ’$a$’ at a/2,+0.3
text ’$b$’ at 0.3,b/2
set texthalign left ; set textvalign center
text ’$L=a(1-e\^{}2)$’ at  0.2-fd,slr/2

# Display diagram
set display ; refresh

\includegraphics[width=8cm]{examples/eps/ex_ellipse}