Matplotlib
Howdy very nice web site!! Guy .. Excellent .. Superb .. I'll bookmark your web site and take the feeds additionallyI am glad to search out so many helpful info here in the put up, we want develop more techniques in this regard, thanks for sharing. eebdadceckddebdg
Very nice site!
Very nice site!
Very nice site!
Bonus exercises
1. Letter frequency analysis of the US Constitution
- Run
python constitution.py
. It will generate a bar chart showing the frequency of each letter in the alphabet in the US Constitution. - Open and read through
constitution.py
. The code for gathering and displaying the frequencies is a bit more complicated than the previous scripts in this projects, but try to trace the general strategy for plotting the data. Be sure to read the comments! - Try to answer the following questions:
- On line 11, what is
string.ascii_lowercase
? - On line 18, what is the purpose of
char = char.lower()
? - What are the contents of
labels
after thefor
loop on line 30 completes? - On line 41, what are the two arguments passed to
pyplot.xticks
- On line 44, we use
pyplot.bar
instead of our usualpyplot.plot
. What are the 3 arguments passed topyplot.bar
?
- On line 11, what is
- We've included a mystery text file
mystery.txt
: an excerpt from an actual novel. Alterconstitution.py
to process the data inmystery.txt
instead ofconstitution.txt
, and re-run the script. What do you notice that is odd about this file? You can read more about this odd novel here.
2. Tour the matplotlib gallery
You can truly make any kind of graph with matplotlib. You can even create animated graphs. Check out some of the amazing possibilities, including their source code, at the matplotlib gallery: http://matplotlib.sourceforge.net/gallery.html.
Congratulations!
You've read, modified, and created scripts that plot and analyze data using matplotlib. Keep practicing!