Make a Line of Best Fit in Chart Studio

How to make a line of best fit in Chart Studio

Step 1

Getting Started

A line of best fit, also called a trend line or linear regression, is a straight line drawn on a graph that best represents the data on a plot. This line passes through some of the points, all of the points, or none of the points. It can be used to make predictions or to show trends in data. It's a pretty cool feature to add to your plots, so let's get started!

Step 2

Add Your Data

Create Your Plot

After your data's been added, go to GRAPH on the left-hand side, then 'Create'. Choose your 'Chart type', and add your traces using the X and Y dropdown (this section is different depending on the chart type).

Like the way we've styled this plot? For more styling tips, see this tutorial!

Step 4

Select Your Fit

When you've finished plotting your data, visit the ANALYSIS section on the left-hand side of your workspace. Click on the blue '+ Analysis' button, then click on the dropdown menu and select 'Fit'.

Select your 'Target Trace' (remember, these are the traces you've set up earlier). You'll then have to select the function you want under 'Function Family'. The dropdown menu has a few to choose from including linear, quadratic, polynomial, and exponential to name a few.

Alternatively, you have the option of adding your own fit function by selecting 'Custom fit function' and entering it in the field. You can also enter your parameters in the 'Constant Estimates' fields.

The blue 'More' button on the bottom right will display two output options. You have the choice of setting your output with evenly spaced points and using the slider to enter your points, or your points matching your X data.

The last thing to do is click 'RUN' at the bottom. We've chosen the 'Linear' function, and this is what our plot looks like with the line of best fit.

Don't forget to save your graph and show it off to your friends by sharing it. For more information on how to save, share, and export, visit this page!