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 aspect ratio of the plot. The aspect ratio describes the apparently height/width ratio of a unit square. If the aspect ratio is not specified, it is set to automatic and will try to fill the graphics object.

#### Code

`plot(sin(x),(x, -10,10), aspect_ratio = 2)`

#### 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

- Plotting a Circle. Plotting a circle of radius $1$ and center $(0,0)$.
- Plotting a Polygon. Plotting a polygon.
- Parametric Plots. Constructing parametric plots.
- Line Plots. Constructing line plots from a table of points.

## 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