Why does matplotlib.pyplot works but not matplotlib.pyplot.plot()? /u/codeforces_help Python Education

Fails : AttributeError: module 'matplotlib' has no attribute 'pyplot'

import matplotlib matplotlib.pyplot.plot([12,3,4], [2,3,4]) 

Succeeds:

import matplotlib.pyplot as plt plt.plot([12,3,4], [2,3,4]) 

What is the difference between the two?

Strangely if I run the second piece of code first and then the first piece then it doesn’t complain.

submitted by /u/codeforces_help
[link] [comments]

​r/learnpython Fails : AttributeError: module ‘matplotlib’ has no attribute ‘pyplot’ import matplotlib matplotlib.pyplot.plot([12,3,4], [2,3,4]) Succeeds: import matplotlib.pyplot as plt plt.plot([12,3,4], [2,3,4]) What is the difference between the two? Strangely if I run the second piece of code first and then the first piece then it doesn’t complain. submitted by /u/codeforces_help [link] [comments] 

Fails : AttributeError: module 'matplotlib' has no attribute 'pyplot'

import matplotlib matplotlib.pyplot.plot([12,3,4], [2,3,4]) 

Succeeds:

import matplotlib.pyplot as plt plt.plot([12,3,4], [2,3,4]) 

What is the difference between the two?

Strangely if I run the second piece of code first and then the first piece then it doesn’t complain.

submitted by /u/codeforces_help
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *