DEV Community

Discussion on: Sentiment analysis on Trump's tweets using Python 🐍

Collapse
 
theajsingleton profile image
Alex Singleton

Hi there, I was having some trouble with the "visualizing the statistics" section as detailed in sections 2.1 and 2.2; if you take a look at my GitHub repo, you'll notice I had to comment out # %matplotlib inline and replaced requirement with plt.ion() within the script-running file (trumpet.py) in order to run the scripts without failure (e.g. python3 trumpet.py). Can you please explain how to generate the visualizations as detailed in those sections? For some reason, I'm unable to render those visual within my Jupyter Notebook-env/config. I'm only 10 days new to Python, so I'd appreciate any guidance. Great tutorial-
thanks!

Collapse
 
rodolfoferro profile image
Rodolfo Ferro

Sure! It's quite easy actually. :)

Instead of adding plt.ion() at the beginning, you can add the following code each time you're generating a plot, in order to visualize it: plt.show(). This will open an external window and display the immediately last plot generated.

You can see this in the Official Pyplot tutorial I shared at the end (References).

Please let me know I you have any other problem. :)

Collapse
 
theajsingleton profile image
Alex Singleton

Got it, Rodolfo! Thank you for the guidance- tremendous fun! ;)