Skip to content
Plotly templates

Math — Plot: Sine & 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":"#2563eb","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.003]},
    {"type":"scatter","mode":"lines","name":"cos x","line":{"color":"#db2777","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.990,-0.936,-0.654,-0.211,0.284,0.709,0.960,1.000]}
  ],
  "layout": {"title":"Sine and cosine","xaxis":{"title":"x (radians)"},"yaxis":{"title":"y"}}
}