Skip to content

Commit 6778dce

Browse files
Smit-createmmcky
andauthored
Fix matplotlib warnings (#368)
* Use fill instead of shade * Use seaborn to avoid matplotlib warnings * Fix seaborn style warnings --------- Co-authored-by: mmcky <[email protected]>
1 parent a503a39 commit 6778dce

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

lectures/ols.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ import pandas as pd
6666
import statsmodels.api as sm
6767
from statsmodels.iolib.summary2 import summary_col
6868
from linearmodels.iv import IV2SLS
69+
import seaborn as sns
70+
sns.set_theme()
6971
```
7072

7173
### Prerequisites
@@ -100,8 +102,6 @@ between GDP per capita and the protection against
100102
expropriation index
101103

102104
```{code-cell} python3
103-
plt.style.use('seaborn')
104-
105105
df1.plot(x='avexpr', y='logpgp95', kind='scatter')
106106
plt.show()
107107
```
@@ -701,4 +701,4 @@ for $\beta$, however `.solve()` is preferred as it involves fewer
701701
computations.
702702

703703
```{solution-end}
704-
```
704+
```

lectures/pandas_panel.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,16 @@ Using this series, we can plot the average real minimum wage over the
361361
past decade for each country in our data set
362362

363363
```{code-cell} ipython
364-
%matplotlib inline
365364
import matplotlib.pyplot as plt
366-
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
367-
import matplotlib
368-
matplotlib.style.use('seaborn')
365+
import seaborn as sns
366+
sns.set_theme()
367+
```
369368

370-
merged.mean().sort_values(ascending=False).plot(kind='bar', title="Average real minimum wage 2006 - 2016")
369+
```{code-cell} ipython
370+
merged.mean().sort_values(ascending=False).plot(kind='bar',
371+
title="Average real minimum wage 2006 - 2016")
371372
372-
#Set country labels
373+
# Set country labels
373374
country_labels = merged.mean().sort_values(ascending=False).index.get_level_values('Country').tolist()
374375
plt.xticks(range(0, len(country_labels)), country_labels)
375376
plt.xlabel('Country')
@@ -468,12 +469,10 @@ minimum wages in 2016 for each continent.
468469
object
469470

470471
```{code-cell} python3
471-
import seaborn as sns
472-
473472
continents = grouped.groups.keys()
474473
475474
for continent in continents:
476-
sns.kdeplot(grouped.get_group(continent).loc['2015'].unstack(), label=continent, shade=True)
475+
sns.kdeplot(grouped.get_group(continent).loc['2015'].unstack(), label=continent, fill=True)
477476
478477
plt.title('Real minimum wages in 2015')
479478
plt.xlabel('US dollars')
@@ -617,4 +616,4 @@ plt.show()
617616
```
618617

619618
```{solution-end}
620-
```
619+
```

0 commit comments

Comments
 (0)