Skip to content

Commit db3f3a5

Browse files
committed
Shorten lines below 100 characters
1 parent 2002391 commit db3f3a5

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

_episodes/03-matplotlib.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1818
lecture of its own, but we can explore a few features of Python's `matplotlib` library here. While
1919
there is no official plotting library, `matplotlib` is the _de facto_ standard. First, we will
2020
import the `pyplot` module from `matplotlib` and use two of its functions to create and display a
@@ -31,11 +31,12 @@ matplotlib.pyplot.show()
3131
from blue to yellow.](../fig/inflammation-01-imshow.svg)
3232

3333
Each 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

5556
Here, 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
5960
average 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.
8485
This script below uses a number of new commands. The function `matplotlib.pyplot.figure()`
8586
creates a space into which we will place all of our plots. The parameter `figsize`
8687
tells 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
8990
refers to the total number of subplot columns, and the final parameter denotes which subplot
9091
your variable is referencing (left-to-right, top-to-bottom). Each subplot is stored in a
9192
different variable (`axes1`, `axes2`, `axes3`). Once a subplot is created, the axes can

_episodes/05-loop.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ In the episode about visualizing data,
1919
we wrote Python code that plots values of interest from our first
2020
inflammation dataset (`inflammation-01.csv`), which revealed some suspicious features in it.
2121

22-
![Line graphs showing average, maximum and minimum inflammation across all patients over a 40-day period.](../fig/03-loop_2_0.png)
22+
![Line graphs showing average, maximum and minimum inflammation across all patients over a 40-day
23+
period.](../fig/03-loop_2_0.png)
2324

2425
We have a dozen data sets right now and potentially more on the way if Dr. Maverick
2526
can keep up their surprisingly fast clinical trial rate. We want to create plots for all of
@@ -149,7 +150,8 @@ for variable in collection:
149150

150151
Using the odds example above, the loop might look like this:
151152

152-
![Loop variable 'num' being assigned the value of each element in the list `odds` in turn and then being printed](../fig/05-loops_image_num.png)
153+
![Loop variable 'num' being assigned the value of each element in the list `odds` in turn and
154+
then being printed](../fig/05-loops_image_num.png)
153155

154156
where each number (`num`) in the variable `odds` is looped through and printed one number after
155157
another. The other numbers in the diagram denote which loop cycle the number was printed in (1

_episodes/06-files.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ consistently zero across every day of the trial. If we produce a heat map for th
120120
we see the following:
121121

122122
![Heat map of the third inflammation dataset. Note that there are sporadic zero values throughout
123-
the entire dataset, and the last patient only has zero values over the 40 day study.](../fig/inflammation-03-imshow.svg)
123+
the entire dataset, and the last patient only has zero values over the 40 day study.
124+
](../fig/inflammation-03-imshow.svg)
124125

125126
We can see that there are zero values sporadically distributed across all patients and days of the
126127
clinical trial, suggesting that there were potential issues with data collection throughout the

0 commit comments

Comments
 (0)