Skip to content
Advertisement

displaying fixed width bars for all datasets in matplotlib

I have the following datasets .I need to plot barchats for say 1,2 or all of them.When I plot the chart for a single data item (eg: xdata=[0] and ydata=[1000], xlabels=['first'] , the bar is sclaed to occupy the whole plot area.How do I restrict the barwidth to be say 0.45?

JavaScript

When I tried

JavaScript

I got this figure http://i.stack.imgur.com/nhHEM.jpg

But when I called

JavaScript

I get this fat bar

http://i.stack.imgur.com/e0IJi.jpg

So, how do I make the plot show each bar with fixed width? It seems the width=barwidth in bar() doesn’t work as I expected it would.. Very likely I am missing something..

Please help

Advertisement

Answer

They are actually the same bar width, it’s just your x-axis scale that is different. See:

JavaScript

1

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement