Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168704
Image: ubuntu2004

Sage's plotting tools are easy to learn. Let's try a simple plot.

plot(sin(pi*x+pi/2))

As in Matlab, we can assign a plot to a variable. If we have assigned

plot1=plot(f(x)) and plot2=plot(g(x)),

we can display both plots on the same figure with three equivalent commands:

1) show(plot1+plot2)

2) plot1+plot2

3) figure=plot1+plot2

    figure.show()

Let's try a multiplot figure using two of Sage's plot options:

thickness: changes the line thickness of a function

rgbcolor: specifies color as a mixture of pure red, green, blue. Syntax: (red,green,blue).

 

G = plot(cos, -5, 5, thickness=5, rgbcolor=(1,0,0)) P = polygon([[1,2], [5,6], [5,0]], color='red') G+P

This figure highlights another neat capability: shape plotting. We'll explore this and adding text to figures in sageplotting1.