Skip to content
Plotly templates

Maths — Sine and Cosine

One period of the sine and cosine functions.

Template previewPlotly
Rendering…

Make it your own.

{
  "data": [
    {"type":"scatter","mode":"lines","name":"sin x","line":{"color":"#6366f1","width":3},
     "x":[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.28],
     "y":[0,0.479,0.841,0.997,0.909,0.599,0.141,-0.351,-0.757,-0.978,-0.959,-0.706,-0.279,0]},
    {"type":"scatter","mode":"lines","name":"cos x","line":{"color":"#dc2626","width":3},
     "x":[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.28],
     "y":[1,0.878,0.540,0.071,-0.416,-0.801,-0.99,-0.936,-0.654,-0.211,0.284,0.709,0.96,1]}
  ],
  "layout": {"title":"Sine and cosine","xaxis":{"title":"x (radians)"},"yaxis":{"title":"y"}}
}