首页 > 解决方案 > matplotlib 窗口在光标移动时不规则地改变大小

问题描述

使用下面的代码,我得到一个窗口,当我将鼠标悬停在它上面时,它会不规则地改变大小。我究竟做错了什么?

(我在 Ubuntu 18 上使用 Python 3.6 和 matplotlib 2.2.2)

在此处输入图像描述

fig,axs = plt.subplots(3,1,figsize=(4,6))
#fill each axis with standard ax.plot commands
[ax.set_ylim([-2,2]) for ax in axs]
[ax.text(x=1.1,y=0,s=f"$f_{{{i+1}}}-f_{{{i}}}$") for i,ax in enumerate(axs)]
fig.subplots_adjust(
    left  = 0.1,  # the left side of the subplots of the figure
    right = 0.7  ,  # the right side of the subplots of the figure
    bottom = 0.1 ,  # the bottom of the subplots of the figure
    top = 0.9 ,  # the top of the subplots of the figure
    wspace = 0.9 ,  # the amount of width reserved for blank space between subplots
    hspace = 0.9 ,  # the amount of height reserved for white space between subplots
)
plt.show()

标签: pythonmatplotlib

解决方案


推荐阅读