Home > Commands -> 2d Commands -> plot


EXAMPLES ON MY SAGE PAGE: plot - Options


Syntax:  plot( f(x) , (x, xmin, xmax), options for 1d object, options for 2d plot )

   plot() plots an explicit function of 1 independent cartesian (rectangular) variable in the plane. You need a function and a range. Everything else is optional.


Options for 2d plot:  figsize, aspect_ratio, ymin, ymax, ... Options are separated by commas. See the examples in the sage pages!

Option
Example
Comment
figsize
figsize=4
The size of the bounding box
Default is 8
aspect_ratio
aspect_ratio=5
5 stretches the y-axis by factor of 5
0.2 shrinks the y-axis by factor of 5

Default is 1, but actual ratio depends on ranges of x and y

3D: aspect_ratio=[2,1,3] (three numbers)

ymin
ymin=0
The bottom of the bounding box.

Default is determined by the y-values for the x-range

ymax
ymax=5
The top of the bounding box.

Default is determined by the y-values for the x-range

Options for 1d object:  color, alpha, thickness, linestyle, ...

Since the plot of y=f(x) is a curve which is a 1d object, we include some 1d object options. See also: 1d Objects
color
color='red'
color=(1,0,0)
rgbcolor=(0,.7,0)
hue

Default is 'blue'

alpha
alpha=0.5
Maximum alpha=1
To make something invisible, use alpha=0.

Default is 1

3D command is: opacity

thickness
thickness=3
3 is 3 times thicker
0.5 is 2 times thinner

Default is 1

linestyle
linestyle='--'
Default is '-' (solid)

Reference: http://www.sagemath.org/doc/reference/sage/plot/plot.html


Keywords: plot, 2d plot, 2d plot options, 1d object options, function, explicit