[英]Why does this object display function even if I haven't explicitly used plt.show function?
z = plt.subplots(2,2)
z
Then the output is as follows : 然后输出如下:
>> (<matplotlib.figure.Figure at 0x28409ef3a90>,
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x0000028409F810B8>,
<matplotlib.axes._subplots.AxesSubplot object at 0x000002840A163B00>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x000002840A1D71D0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x000002840A237518>]], dtype=object))
Since z[0]
is an Figure object, I expected <matplotlib.figure.Figure at 0x28409ef3a90>
to be the output if I run z[0]
. 因为z[0]
是一个Figure对象,所以如果我运行z[0]
,我希望<matplotlib.figure.Figure at 0x28409ef3a90>
可以作为输出。 But it displays 2x2 plot even if I haven't used display.show()
explicitly! 但是,即使我没有显式使用display.show()
它也会显示2x2绘图! Why does such thing happen? 为什么会这样呢?
iPython outputs the repr
value of the object z
in the output space. iPython在输出空间中输出对象z
的repr
值。
in this case, a matplotlib Figure
object. 在这种情况下,将使用matplotlib Figure
对象。
iPython does this when the last line executed is simply the object (not an assignment) 当执行的最后一行仅仅是对象(而不是赋值)时,iPython会执行此操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.