Skip to content

Commit 87e1eb3

Browse files
committed
I totally did this in a single commit
1 parent c127f46 commit 87e1eb3

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

_episodes/08-putting-it-all-together.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ ax2.hist(beta_draws)
218218
{: .challenge}
219219
220220
221+
221222
### Link matplotlib, Pandas and plotnine
222223
223224
When we create a plot using pandas or plotnine, both libraries use matplotlib
@@ -297,6 +298,23 @@ plt.show() # not necessary in Jupyter Notebooks
297298
> > flood.plot(x ="datetime", y="flow_rate", ax=ax)
298299
> > discharge.plot(x ="datetime", y="flow_rate", ax=ax2)
299300
> > ax2.legend().set_visible(False)
301+
> > ax.set_xlabel("") # no label
302+
> > ax.set_ylabel("Discharge, cubic feet per second")
303+
> > ax.legend().set_visible(False)
304+
> > ax.set_title(" Front Range flood event 2013")
305+
> > discharge = pd.read_csv("../data/bouldercreek_09_2013.txt",
306+
> > skiprows=27, delimiter="\t",
307+
> > names=["agency", "site_id", "datetime",
308+
> > "timezone", "flow_rate", "height"])
309+
> > fig, ax = plt.subplots()
310+
> > flood = discharge[(discharge["datetime"] >= "2013-09-11") &
311+
(discharge["datetime"] < "2013-09-15")]
312+
>>
313+
> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])
314+
>> flood.plot(x ="datetime", y="flow_rate", ax=ax)
315+
> > discharge.plot(x ="datetime", y="flow_rate", ax=ax2)
316+
> > ax2.legend().set_visible(False)
317+
300318
> > ax.set_xlabel("") # no label
301319
> > ax.set_ylabel("Discharge, cubic feet per second")
302320
> > ax.legend().set_visible(False)

fig/dualdistribution.png

7.56 KB
Loading

fig/floodevent.png

23.3 KB
Loading

0 commit comments

Comments
 (0)