@@ -13,8 +13,8 @@ keypoints:
1313---
1414
1515## Visualizing data
16- The mathematician Richard Hamming once said, "The purpose of computing is insight, not numbers," and
17- the best way to develop insight is often to visualize data. Visualization deserves an entire
16+ The mathematician Richard Hamming once said, "The purpose of computing is insight, not numbers,"
17+ and the best way to develop insight is often to visualize data. Visualization deserves an entire
1818lecture of its own, but we can explore a few features of Python's ` matplotlib ` library here. While
1919there is no official plotting library, ` matplotlib ` is the _ de facto_ standard. First, we will
2020import the ` pyplot ` module from ` matplotlib ` and use two of its functions to create and display a
@@ -31,11 +31,12 @@ matplotlib.pyplot.show()
3131from blue to yellow.] ( ../fig/inflammation-01-imshow.svg )
3232
3333Each row in the heat map corresponds to a patient in the clinical trial dataset, and each column
34- corresponds to a day in the dataset. Blue pixels in this heat map represent low values, while yellow
35- pixels represent high values. As we can see, the general number of inflammation flare-ups for the patients
36- rises and falls over a 40-day period.
34+ corresponds to a day in the dataset. Blue pixels in this heat map represent low values, while
35+ yellow pixels represent high values. As we can see, the general number of inflammation flare-ups
36+ for the patients rises and falls over a 40-day period.
3737
38- So far so good as this is in line with our knowledge of the clinical trial and Dr. Maverick's claims:
38+ So far so good as this is in line with our knowledge of the clinical trial and Dr. Maverick's
39+ claims:
3940
4041* the patients take their medication once their inflammation flare-ups begin
4142* it takes around 3 weeks for the medication to take effect and begin reducing flare-ups
@@ -54,8 +55,8 @@ matplotlib.pyplot.show()
5455
5556Here, we have put the average inflammation per day across all patients in the variable
5657` ave_inflammation ` , then asked ` matplotlib.pyplot ` to create and display a line graph of those
57- values. The result is a reasonably linear rise and fall, in line with Dr. Maverick's claim that the
58- medication takes 3 weeks to take effect. But a good data scientist doesn't just consider the
58+ values. The result is a reasonably linear rise and fall, in line with Dr. Maverick's claim that
59+ the medication takes 3 weeks to take effect. But a good data scientist doesn't just consider the
5960average of a dataset, so let's have a look at two other statistics:
6061
6162~~~
@@ -84,8 +85,8 @@ You can group similar plots in a single figure using subplots.
8485This script below uses a number of new commands. The function ` matplotlib.pyplot.figure() `
8586creates a space into which we will place all of our plots. The parameter ` figsize `
8687tells Python how big to make this space. Each subplot is placed into the figure using
87- its ` add_subplot ` [ method] ({{ page.root }}/reference.html#method). The ` add_subplot ` method takes 3
88- parameters. The first denotes how many total rows of subplots there are, the second parameter
88+ its ` add_subplot ` [ method] ({{ page.root }}/reference.html#method). The ` add_subplot ` method takes
89+ 3 parameters. The first denotes how many total rows of subplots there are, the second parameter
8990refers to the total number of subplot columns, and the final parameter denotes which subplot
9091your variable is referencing (left-to-right, top-to-bottom). Each subplot is stored in a
9192different variable (` axes1 ` , ` axes2 ` , ` axes3 ` ). Once a subplot is created, the axes can
0 commit comments