pad_inches=0 and bbox_inches=“tight” makes the plot smaller than declared figsize

前端 未结 3 1090
死守一世寂寞
死守一世寂寞 2020-12-08 07:10

I am producing a publication-quality plot to be embedded in latex and I would like to be very precise in terms of sizes and fonts (so that fonts are of the same size in the

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 08:01

    I have the same problem making matplotlib plots for LaTeX. Since my plots did not allow to use tight_layout, giving this warning, I ended up using fig.subplots_adjust(bottom=bottom_pos, top=top_pos, left=left_pos, right=right_pos). See this tutorial. It requires manually finding the best values for bottom_pos etc. but in my case it seems to be the only possibility to get images without much whitespace not changing the figure size of the output.

提交回复
热议问题