# Add Trendline

### Overview

This procedure adds a mathematical trendline to an existing **scatter plot** to help visualize data trends. You can choose between linear *(straight line)* or quadratic *(curved line)* trendlines.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>add a {linear|quadratic} trendline to the plot</code></summary>

#### What does it do?

Adds a straight-line trendline to the scatter plot.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — A reference to **the plot** must be defined in the automation. Replace the adjective with `linear` to add a linear trendline or `quadratic` to add a quadratic trendline. The default is `linear`.

#### Example

```
add a linear trendline to the plot
```

</details>

### Examples

#### 1. Linear Trendline

```
create a scatter plot where
    the x values are [1, 2, 3, 4, 5, 6]
    the y values are [65, 72, 78, 85, 91, 97]
    the title is "Score vs Study Time"
    the x label is "Study Hours"
    the y label is "Test Score"
    the style is "white"
add a linear trendline to the plot
show the plot
```

#### 2. Quadratic Trendline

```
create a scatter plot where
    the x values are [1, 2, 3, 4, 5]
    the y values are [2, 8, 18, 32, 50]
    the title is "Quadratic Growth Pattern"
add a quadratic trendline to the plot
show the plot
```
