Reputation: 13
Just a small question. I have VS Code installed and trying it out with Python but no matter what I try I cannot get matplotlib plots to appear.
Here is a simple code that does NOT work
import mglearn
import matplotlib.pyplot as plt
X, y = mglearn.datasets.make_wave(n_samples=40)
plt.plot(X, y, 'o')
plt.ylim(-3, 3)
plt.xlabel("Feature")
plt.ylabel("Target")
No error with the code appears but also no plot. Thanks.
Please note mglearn comes from the following Github https://github.com/amueller/mglearn
Upvotes: 1
Views: 9320
Reputation: 130
Try plt.show()
at the end.
And this additional line is just because the system asks me extra text for no reason.
Upvotes: 3
Reputation: 11929
Your code works. You need to ask for the picture to be shown plt.show() or to be saved plt.savefig().
Just add plt.show()
and you will obtain:
Upvotes: 0