BZ.
BZ.

Reputation: 1946

How to force plotly to display x axis numbers as categories?

I have a dataset where I'm referring to samples as numbers - when I try and do a bar graph using plotly (in JS) it's treating them as numbers and not as a label. How can I turn that off?

Upvotes: 7

Views: 5250

Answers (1)

etpinard
etpinard

Reputation: 5011

You can override plotly's axis auto-type routine by specifying the axis type. For example,

var data = [/* your data */];

var layout = {
   xaxis: { type: 'category' }
};

Plotly.plot('graph', data, layout);

Upvotes: 14

Related Questions