python - Invalid syntax error returned for %matplotlib -


i'm experiencing trouble importing below libraries displayed within below markdown, required python sentiment analysis via twitter:

# general: import tweepy           # consume twitter's api import pandas pd     # handle data import numpy np      # number computing  # plotting , visualization: ipython.display import display import matplotlib.pyplot plt import seaborn sns %matplotlib 

although new python3/pip, rubyist/elephpant, i'm no stranger homebrew- after commenting-out %matplotlib file apparently imports libraries listed except%matplotlib, appears the jupyter invocation- how correctly load import %matplotlib in standard python (3.6.2) in order avoid below error? there alternative approach?

 file "toolbox.py", line 10     %matplotlib     ^ syntaxerror: invalid syntax 

thank you!

as documentation explains:

starting ipython 5.0 , matplotlib 2.0 can avoid use of ipython’s specific magic , use matplotlib.pyplot.ion()/matplotlib.pyplot.ioff() which have advantages of working outside of ipython well.

(emphasis mine)

so in case use:

plt.ion() 

instead of bare %matplotlib.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -