Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Histogram getting issues with my data

Hello,

I 'm creating a histogram but getting issues with that. Here is my code.

var x = [“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12”];
var y=[1275.5506213987728, 1290.7307725817402, 1302.7705921254517, 1243.072037173642, 1162.4230535715515, 1149.6843381106778, 1162.1262680994546, 1069.311558075748, 1058.0760042458824, 1007.6567717160162, 1029.8077281040871, 1010.439987814117];

var data = [
{
x:x,
y:y,
type: ‘histogram’,
marker: {
color: ‘rgba(100,250,100,0.7)’,
},
}
];
var layout = {
xaxis: {title: “Variance”},
yaxis: {title: “Location”}
};
Plotly.newPlot(‘myDiv’, data,layout);

Here is my Output -

Plotly histograms expect only one sample variable (i.e or x or y) with it, they compute the frequency coordinates.

With your data, you should try plotting a bar trace.

OK, Thanks much. Will try that.