首页 > 解决方案 > 初始化后调整 matplotlib 图形的大小

问题描述

创建/初始化 matplotlib 图形后,如何调整它的大小?

fig, ax = plt.subplots(figsize=(4, 3))
pd.Series([1, 2, 3]).plot(ax=ax)    
# which command to use to? below obviously does not work
fig.set_figsize((6, 6))

标签: pythonpython-3.xmatplotlib

解决方案


要使用的命令是 set_size_inches:

fig.set_size_inches((6, 6))

回答我自己的问题(它没有出现在我的搜索中,希望这个线程会出现)。


推荐阅读