A question about how plot from matplotlib works
ast
nomail at invalid.com
Thu Feb 19 05:47:34 EST 2015
Hello
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> x = np.arange(10)
>>> y = x**2
>>> x
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> y
array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])
>>> plt.plot(x,y)
[<matplotlib.lines.Line2D object at 0x044F5930>]
>>> plt.show()
The question is:
plt.plot() creates an object "matplotlib.lines.Line2D" but this object is
not referenced. So this object should disapear from memory. But
this doesn't happens since plt.show() draws the curve on a graphic
window. So how does it work ?
More information about the Python-list
mailing list