✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

How to change the size of plot, not of figure

I have a figure with a plot inside. How can I make the plot of a specific size? If I change the layout of the figure then the plotting area depends also on the size of the plot title, the ticks labels, etc (for a specific figure size, the bigger a title, the smaller the plotting area will be).

The reason I want to achieve this is that I have two barplots and I would like each bar to have the same width. The first barplot have 3 bars and the second have 4. If I set the width of the figure to be 40 * n_of_bars, then the bars will result in different size since the plot title is bigger in one of the two plots and so it steals space to the plot.

Hi @LucaMarconato you can fix the width of the plotted area by setting the domain attribute of xaxis or yaxis, as explained in this example of the axes tutorial. Probably for your application you also want to set the range of the axis.

1 Like