Skip to content

Instantly share code, notes, and snippets.

@pbogden
Last active February 1, 2019 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbogden/2b8945eeebf48798c8ff6d0d7230710c to your computer and use it in GitHub Desktop.
Save pbogden/2b8945eeebf48798c8ff6d0d7230710c to your computer and use it in GitHub Desktop.
plot.ly scatterplot
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
<script>
var trace1 = {
x: [1, 2, 3, 4],
y: [10, 15, 13, 17],
mode: 'markers',
type: 'scatter'
};
var trace2 = {
x: [2, 3, 4, 5],
y: [16, 5, 11, 9],
mode: 'lines',
type: 'scatter'
};
var trace3 = {
x: [1, 2, 3, 4],
y: [12, 9, 15, 12],
mode: 'lines+markers',
type: 'scatter'
};
var data = [trace1, trace2, trace3];
Plotly.newPlot('myDiv', data);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment