2D Histogram Contour in JavaScript
How to make D3.js-based 2D Histogram Contour plots in Plotly.js.
New to Plotly?
Plotly is a free and open-source graphing library for JavaScript. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.
var x = [];
var y = [];
for (var i = 0; i < 500; i ++) {
x[i] = Math.random();
y[i] = Math.random() + 1;
}
var data = [
{
x: x,
y: y,
type: 'histogram2dcontour'
}
];
Plotly.newPlot('myDiv', data);
var x = [];
var y = [];
for (var i = 0; i < 500; i ++) {
x[i] = Math.random();
y[i] = Math.random() + 1;
}
var data = [
{
x: x,
y: y,
colorscale: 'Blues',
type: 'histogram2dcontour'
}
];
Plotly.newPlot('myDiv', data);
var x = [];
var y = [];
for (var i = 0; i < 500; i ++) {
x[i] = Math.random();
y[i] = Math.random() + 1;
}
var data = [
{
x: x,
y: y,
colorscale: 'Blues',
type: 'histogram2dcontour',
contours: {
showlabels: true,
labelfont: {
family: 'Raleway',
color: 'white'
}
},
hoverlabel: {
bgcolor: 'white',
bordercolor: 'black',
font: {
family: 'Raleway',
color: 'black'
}
}
}
];
Plotly.newPlot('myDiv', data);