Seaborn - World Cup Data - set_palette() not working

I can only set the palette when using that parameter in the sns.barplot( palette=‘pastel’) fucniton. If I use sns.set_palette(‘pastel’) nothing happens. It worked in earlier exercises so I’m not sure what’s diferent here. I’ve tried putting sns.set_palette() before/after the sns.barplot and creating the figure and none have fixed it.
Link to exercise:

import codecademylib3_seaborn

from matplotlib import pyplot as plt

import pandas as pd

import seaborn as sns

df = pd.read_csv('WorldCupMatches.csv')

df_goals = pd.read_csv('goals.csv')

df['Total Goals'] = df['Home Team Goals'] + df['Away Team Goals']


#set styling


sns.set_context('notebook', font_scale=1.25)

f, ax = plt.subplots(figsize=(12,7))


#plot 1 - using set_palette() has no effect

sns.barplot(data=df, x='Year', y='Total Goals')

ax.set_title('Average Number Of Goals Scored In World Cup Matches By Year')


#plot 2 - using palette parameter here works

f, ax2 = plt.subplots(figsize=(12,7))

ax2 = sns.boxplot(data=df_goals, x='year', y='goals', palette='Spectral')

ax2.set_title('Box Plot Of Goals Scored in World Cup Matches By Year')

I think you just have to use the palette = " " parameter for each plot, rather than setting a default color palette.


sns.set_context('notebook', font_scale=1.5)
f, ax =plt.subplots(figsize=(12, 7))

ax = sns.barplot(data= df, x = 'Year', y='Total Goals', palette ='colorblind')
ax.set_title('Average Goals by Year, FIFA World Cup- 1930-2014')