Verified Commit 6bb08950 authored by Toby Hodges's avatar Toby Hodges
Browse files

move subplots challenge

parent 8848224a
...@@ -609,6 +609,15 @@ plt.title(f"$X \\sim \\mathcal{N}(\\mu,\\,\\sigma^{2})$ - $\\mu$={mean}, $\\sigm ...@@ -609,6 +609,15 @@ plt.title(f"$X \\sim \\mathcal{N}(\\mu,\\,\\sigma^{2})$ - $\\mu$={mean}, $\\sigm
## Histograms ## Histograms
## Subplots ## Subplots
- the next exercise assumes an example of subplots arranged in a single row or column
> ## Rearranging Subplots
>
> Change the function definition above
> so that the subplots are organised in two rows,
> leaving the bottom-left corner empty.
{: .challenge}
## Others (link to docs) ## Others (link to docs)
# Axis # Axis
...@@ -913,20 +922,6 @@ https://matplotlib.org/tutorials/introductory/usage.html#the-builtin-backends ...@@ -913,20 +922,6 @@ https://matplotlib.org/tutorials/introductory/usage.html#the-builtin-backends
> {: .solution } > {: .solution }
{: .challenge } {: .challenge }
- before the next exercise:
~~~
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import cm
gapminder = pd.read_csv('data/gapminder_all.csv', index_col='country')
~~~
{: .language-python }
- function from previous exercise also required
> ## Formatting Data Points > ## Formatting Data Points
> >
> 1. Fill in the blanks in the function definition below > 1. Fill in the blanks in the function definition below
...@@ -943,6 +938,8 @@ gapminder = pd.read_csv('data/gapminder_all.csv', index_col='country') ...@@ -943,6 +938,8 @@ gapminder = pd.read_csv('data/gapminder_all.csv', index_col='country')
> to remind yourself of what is happening here. > to remind yourself of what is happening here.
> >
> ~~~ > ~~~
> from matplotlib import cm
>
> continents = list(gapminder['continent'].unique()) > continents = list(gapminder['continent'].unique())
> continent_colors = [cm.Set2.colors[continents.index(c)] for ___ in gapminder[___]] > continent_colors = [cm.Set2.colors[continents.index(c)] for ___ in gapminder[___]]
> >
...@@ -1031,15 +1028,6 @@ gapminder = pd.read_csv('data/gapminder_all.csv', index_col='country') ...@@ -1031,15 +1028,6 @@ gapminder = pd.read_csv('data/gapminder_all.csv', index_col='country')
> {: .solution } > {: .solution }
{: .challenge } {: .challenge }
- the next exercise assumes an example of subplots arranged in a single row or column
> ## Rearranging Subplots
>
> Change the function definition above
> so that the subplots are organised in two rows,
> leaving the bottom-left corner empty.
{: .challenge}
> ## The coffee stain > ## The coffee stain
> >
> Accidents happen and hard lessons often come in a spiky package! > Accidents happen and hard lessons often come in a spiky package!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment