Two-Dimensional Plots

Description

The Sage command for plotting $y = \sin(x)$ for $-10 \leq x \leq 10$.

Sage Cell

Code

plot(sin(x),(x, -10,10))

Options

Option

We may change the line thickness and color of plots.

Code

plot(sin(x), (x, -10,10), thickness = 3, color = "red")

Option

We can add axes labels and customize tick marks.

Code

plot(sin(x),(x, -10,10), ticks=[[-7,-3,0,3,7],[-1/2,0,1/2]], axes_labels=['$x$','$y$'])

Option

We may combine plots.

Code

p = plot(sin(x),(x, -10,10))
p += plot(cos(x),(x, -10,10), color="red")
p

Option

We can add a legend for our plots.

Code

p = plot(sin(x),(x, -10,10), legend_label='$\sin x$')
p += plot(cos(x),(x, -10,10), color="red", legend_label='$\cos x$')
p

Tags

Primary Tags: two-dimensional plots, college algebra, precalculus, calculus

Secondary Tags:

Related Cells

Attribute

Author: T. Judson

Permalink: http://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html#sage.plot.plot.plot

Date: 16 Jun 2017 18:58

Submitted by: Tom Judson

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License