设置轴限制时,matplotlib中的图像尺寸太大

时间:2018-09-14 16:02:08

标签: python matplotlib jupyter-notebook

为什么使用以下代码段(在jupyter笔记本中使用pyplot):

plt.rcParams['figure.figsize'] = [10, 10]
plt.hist2d(np.random.randint(1e10, size=100000), 
           np.random.randint(1e10, size=100000)) 
plt.xlim(-1, 1)
plt.ylim(-1, 1)
plt.show()

给出此错误:

ValueError: Image size of -1757369422x-759354895 pixels is too large. It must be less than 2^16 in each direction.

不设置xlimylim即可正常运行。如何有效地设置那种图上显示的边界?

1 个答案:

答案 0 :(得分:0)

似乎是reported中的"You you yyou Yyou yYou youu yoou you'll You're You'ree" 中的错误。