Sage Math Tutorial - Plotting

This page contains interactive Sage widgets - edit and re-evaluate them!

Information on the plotting commands is available in the Sage Documentation

Plotting functions couldn't be easier with the 'plot' command:

Use the 'figsize=(x,y)' option to control the plot size:

Adding a title? Easily done!

You can create an empty plot object and add additional plots and graphics to it:

Use this to plot multiple functions on a single graphic:

Different colors? Different line style? Legend labels? Sure!

Adding graphical objects other than plots? Done!

The 'frame' option puts a box around the plot, and 'axes_labels' does what it sounds like:

Some attributes can also be applied in the 'plot_object.attribute()' format. To see the built-in colors, evaluate 'list(colors)'. To see all plot attributes and options, see the Sage Documentation or evaluate 'plot?' in a Sage Notebook. This does not yet work in a Sage Cell, unfortunately!

Some functions, including numerical differential equation solvers, return lists of points instead of mathematical functions. The 'plot()' function won't work! use list_plot()' instead. Options are the same: