Skip to content
Plotly templates

Math — Plot: Scatter with Trend

A positively correlated scatter with a fitted line.

Template previewPlotly
Rendering…

Make it your own.

{
  "data": [
    {"type":"scatter","mode":"markers","name":"data","marker":{"color":"#7c3aed","size":9},
     "x":[1,2,3,4,5,6,7,8],"y":[2.1,3.9,6.2,7.8,10.1,11.9,14.2,15.8]},
    {"type":"scatter","mode":"lines","name":"trend","line":{"color":"#1f2937","width":2,"dash":"dash"},
     "x":[1,8],"y":[2.0,16.0]}
  ],
  "layout": {"title":"Scatter with line of best fit","xaxis":{"title":"x"},"yaxis":{"title":"y"}}
}