When one works with the library matplotlib.pyplot a simple code example would be:
1
a=[1,2,3,4,5]
b=[1,2,3,4,5]
plt.plot(a,b)
plt.xlim(0,100)
plt.show()
2
a=[1,2,3,4,5]
b=[1,2,3,4,5]
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(a,b)
ax.set_xlim(0,100)
plt,show()
the two codes do the same but they are not the same. My question is to guide the beginners in python language to understand what these lines of code do: What does plt.plot (a, b) of 1 , where does this command save without assigning a value to it? of variable allows me to continue manipulating the final result (graphic) as for example with xlim . Why using subplot and saving it as variable ax allows me to use .set_xlim not so plt.plot which uses xlim?