Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> <body> <div id="myPlot" style="width:100%;max-width:700px"></div> <script> let exp = "Math.cos(x)"; // Generate values const xValues = []; const yValues = []; for (let x = 0; x <= 10; x += 0.2) { xValues.push(x); yValues.push(eval(exp)); } // Display using Plotly const data = [{x:xValues, y:yValues, mode:"markers"}]; const layout = {title: "y = " + exp}; Plotly.newPlot("myPlot", data, layout); </script>