3

I have created a bar chart using the

grouped.plot(kind='bar')

method in Pandas. However the vertical x labels get cut off. when I try to change the bottom variable by saying

grouped.plot(kind='bar',bottom=0.2)

I get an error message:

TypeError: bar() got multiple values for keyword argument 'bottom'

So the method is sending it's own value for bottom and I don't know how to replace that.

I could avoid it and simply use the pyplot bar() method directly, but that means specifying the left and height variables directly and with the groupby object I am using, this will get rather tricky, so I am really hoping not to do that. Is there a way I can pass a different bottom variable through Pandas's .plot(kind='bar') method ?

chrisfs
  • 6,182
  • 6
  • 29
  • 35

1 Answers1

3

One option is to adjust the bottom margin after plotting with the following call.

plt.subplots_adjust(bottom=.3)
Garrett
  • 47,045
  • 6
  • 61
  • 50
  • For met it does adjust the bottom margin, but the vertical x labels still get cut off. I just get a blank space below the cut-off x labels – NeilenMarais Dec 08 '16 at 08:28
  • Actually, disregard my comment, it seems I was messing it up with custom tick formatters :) But if you are interested in adjusting the space between the ticks and the xlabel, see comments discussion about labelpad here: http://stackoverflow.com/questions/21539018/how-to-change-separation-between-tick-labels-and-axis-labels-in-matplotlib – NeilenMarais Dec 08 '16 at 08:45