0

When setting the figure size for my subplots in matplotlib the size is including the size of the x-axis labels. I use the following code:

fig, ax = plt.subplots(figsize=(12, 4))
sns.regplot(ax=ax1, x=data['x'], y = data['y'])

When my x-axis labels are shown vertically and quite long, let's say 12 characters, the height of the plot is cropped. How can I specify the dimensions of a plot excluding the space taken up by the x-axis labels?

Michael
  • 1,281
  • 1
  • 17
  • 32
  • 2
    Did you see [this question](https://stackoverflow.com/questions/44970010/axes-class-set-explicitly-size-width-height-of-axes-in-given-units)? – jwalton Feb 21 '19 at 10:30
  • Consider the duplicate and in this particular case you can call `fig.tight_layout()` followed by calling the function from the duplicate. – ImportanceOfBeingErnest Feb 21 '19 at 18:58

0 Answers0