Reputation: 863
I am a beginner in Python and have a very basic question.
In the matplot library we have show()
function. I just want to know what is the benefit of using show()
function.
For ex. if we have multiple statements such as
plt.scatter(XX,YY)
plt.plot(X,Y)
plt.show() #3rd statement, is it necessary?
We can plot a scatter plot and can superimpose plot on it just by executing these two statements. Whether we write the 3rd statement i.e. plt.show()
hardly matters. Does it matter? When do we use plt.show()
.
Please explain. Thank You.
Upvotes: 1
Views: 82
Reputation: 181
I'm afraid that i understand your question exactly.
'plt.show()' function do visualize your plot. And plt.scatter() and plt.plot() can't visualize its data independently. But you can do it, if you use jupyter-notebook with '%matplotlib inline' command. It helps to show plots without 'plt.show()' command.
Upvotes: 1