Visualizing World Cup Data With Seaborn

The project link is https://www.codecademy.com/paths/data-science/tracks/data-visualization/modules/dspath-seaborn/projects/world-cup-viz

So when I finished this project, I checked the solution video and found that I hadn’t quite done it right. Step 6 says “You are going to create a bar chart visualizing how many goals were scored each year the World Cup was held between 1930-2014.” I took ‘how many goals were scored each year’ to indicate that they wanted a total of goals for each year. So I used

ax = sns.barplot(data = df, x = ‘Year’, y = ‘Total_Goals’, estimator = sum, ci=None)

I changed the estimator to sum to get the goal totals and got rid of the error bars since sums don’t create error. Apparently, the project actually wanted the averages to be graphed. I realize that average is the default estimator for the barplot function, but thought using a different estimator might be part of the challenge.

So just in case anyone else found that confusing or misleading, I thought I’d post about it.

2 Likes

I’m having a similar problem with this as when I save the results, the bar chart does not show up and I don’t know why.

Hi, can someone who got it be kind to explain the following lines:
f, ax = plt.subplots(figzise=(8,12))
ax = sns.boxplot(data = df, x= “colx” , y = "coly)

What is f in the context of this? And are we assigning the subplot to two variables at once? (is it a tuple or what? is f the figure?) and how can we assign both subplot and the boxplot to ax? I get that this is just how it’s done but I want to understand how it works. Thanks :slight_smile:

Hi,
the f, ax part means figure-level function ax means axes-level functions

See documentation here:
https://seaborn.pydata.org/introduction.html