Visualization with Python: Life Expectancy and GDP data

Here is my walkthrough of the capstone project for the “Visualization with Python” skill path. For some reason I could not get the jupyter notebook to save my figure with each iteration. I do not know why. It would make the files using the savefig method but it would not have content about 50% of the time.

Thanks for the feedback.


When you import your libraries at the top of your notebook, you could add %matplotlib inline and that should store your figures/graphs/visualizations in your notebook.

Also, if you want to set the seaborn theme, you can add this ;sns.set() to the top cell (so you won’t have to specify in each viz cell) so it looks like this when you import seaborn:

import seaborn as sns; sns.set()

(the default theme is “darkgrid” I think)

Great job! :partying_face:
Seems like you have an understanding of the data and how to present it.
(I, too, comment out code that I’m going to use in cells b/c sometimes I forget the format).
One thing you might want to do is change the color palette for step 8.(?) it’s kind of difficult to discern what I’m looking at.

One last thing…rather than use powerpoint for the presentation (and subsequently having viewers download the file) you could use Google Slides and change the permissions on it to whoever has the link (view only) and push it to Github that way. It’s just a thought. :slight_smile:


Hi LLJ, Thanks for checking out my work. I will look into fixing the PPTX as a view only link. I have not done that before. Also good to know about the sns.set().

I adjusted the color palette in the notebook. Thank you for that suggestion.

1 Like

Google slides is very similar to PowerPoint (has the same functionality) and the best part is that it is accessed through your Google Drive. So, like I said, if you ever need to share or access it you can do so from anywhere. It’s just a thought. :slight_smile:


first of all thanks for sharing your work. It motivates me to do such a good job as well!

I had the same problem saving the images and found out:

If you use
plt.savefig(‘tessstttyyy.png’, dpi=300)
you get an empty image. Write it before, then it works. For example at step 7, image 2 my code looks like this and the image is saved correctly.

f, ax = plt.subplots(figsize=(10, 15))
ax = sns.barplot(data = df, x=“Country”, y=“LEABY”, hue = “Year”)
plt.xlabel(“Country”, fontsize = 12)
plt.ylabel(“Life expectancy at birth in years”, fontsize = 12)
plt.title(“Life expectancy, by Country”, fontsize = 16)
plt.savefig(‘tessstttyyy.png’, dpi=300)

Maybe this clue helps you :slightly_smiling_face:

1 Like