Add Trendline
Add a linear or quadratic trendline to a scatter plot.
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.
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
Last updated
Was this helpful?