Skip to content

Instantly share code, notes, and snippets.

@j-fu
Created December 11, 2025 18:59
Show Gist options
  • Select an option

  • Save j-fu/607e898ef6e9106983882a23c53d1ebb to your computer and use it in GitHub Desktop.

Select an option

Save j-fu/607e898ef6e9106983882a23c53d1ebb to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Plotly.js Simple Example</title>
<!-- Include Plotly.js library from a CDN -->
<script src="https://cdn.plot.ly/plotly-3.3.0.min.js"> </script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg-full.js"> </script>
</head>
<body>
<!-- Div element where the plot will be rendered -->
<div id="myPlot" style="width:600px;height:400px;"></div>
<script>
// Define the data for the plot
const data = [{
x: [1, 2, 3, 4, 5],
y: [10, 15, 13, 17, 12],
mode: 'markers', // Display points as markers
type: 'scatter' // Type of chart is scatter
}];
// Define the layout for the plot (optional)
const layout = {
title: {text: '$ f: x^3$'},
xaxis: {
title: {text: 'X-axis Label: $\\int x$'},
},
yaxis: {
title: {text: 'Y-axis Label: $y^3$'},
}
};
// Render the plot in the 'myPlot' div
Plotly.newPlot('myPlot', data, layout);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment