rlvaugh / Real_World_Python

Code and supporting files for book Real World Python
169 stars 116 forks source link

plots not plotting #7

Open swanstro opened 3 years ago

swanstro commented 3 years ago

I recently purchased Real World Python and am enjoying the projects. However, I'm not having any luck getting my plots to show up with the stylometry.py code in chapter 2.

I have uncommented the code, and although the python rocket shows up when I run it—and the rest of the code runs just fine in the shell—the plots themselves don't materialize. (Once the code runs in the shell, the rocket disappears.). Fwiw: I don't have any problems generating the dispersion plot in practice_hound_dispersion.py.

I am using python 3.8 via a virtual environment. I am on a mac, and I use BBedit to code (but for now I'm just using the code on your github page (minus the comment ##) : https://github.com/rlvaugh/Real_World_Python/tree/master/Chapter_2

If you have any tips for me, I'd appreciate it. Thanks!

rlvaugh commented 3 years ago

Sorry you are having trouble. Matplotlib only wants one plot.show() call. Have you tried running the code with the comments (##) on and only the last plot call, in the parts_of_speech_test() function, NOT commented out? This should bring up all the plots at once, after the code completes. You may see blank windows for a few tens of seconds, depending on your computer.

swanstro commented 3 years ago

Hi there, Thanks so much for writing back. I have tried that but it hasn't worked, unfortunately. The nltk plots are working ok for me (I tried a shorter version and used freqDist.plot(50, cumulative=True)) but the plt.show() isn't... Take care, Lisa

========================== Lisa Swanstrom | swanstream.org Assoc. Prof. | Director of Graduate Studies Department of English, University of Utah Co-editor, Science Fiction Studies https://www.jstor.org/journal/sciefictstud

On Tue, Nov 2, 2021 at 12:51 PM rlvaugh @.***> wrote:

Sorry you are having trouble. Matplotlib only wants one plot.show() call. Have you tried running the code with the comments (##) on and only the last plot, for the parts-of-speech, NOT commented out?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rlvaugh/Real_World_Python/issues/7#issuecomment-958051808, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIMDLWZNS5LG6DWK6ZN2DLUKA6LBANCNFSM5HG7EF7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.