Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plotly.js - How to fix space between bars in barchart

Is there any configuration layout option to increase the space between the bars in a bar plot in plotly.js ?

I tried increasing the width of the plot but it is expanding the plot as a whole.I need to fix the width of the bar and space between the bars.

Any help would be highly helpful.

like image 825
Durga Prasad Avatar asked Oct 27 '16 03:10

Durga Prasad


1 Answers

It is a setting of layout The key value pair for the layout object to change the gap is bargap. For example given arrays x and y:

Plotly.newPlot('myDiv', [{x:x, y:y, type:'bar'}],{title:'title',xaxis: {title: 'abscissa'},yaxis:{title:'ordinate'},bargap:0});

Will generate a plot with no gap like a histogram.

like image 65
Matteo Ferla Avatar answered Nov 08 '22 08:11

Matteo Ferla