Recently I saw a very cool scatterplot graph in a video which displayed the The Simpsons TV Show episode ratings over the seasons. I thought it would be a very cool python project. Here's the graph I saw: Video Plot
I have a dataframe with the the seasons, the episodes number and the ratings of each. Here's the scatterplot in my script:
### PLOT
plt.figure(figsize=(20, 8))
# scatterplot
sns.scatterplot(
data=df,
x='Episode Number',
y='Rating',
hue='Season',
palette='tab10',
s=50
)
# regression line
sns.regplot(
data=df,
x='Episode Number',
y='Rating',
scatter=False,
ci=None,
line_kws={
'color':'red',
'linestyle':'-',
'linewidth':3,
'alpha':0.3
}
)
this is the output My plot
As you can see, for each 10 seasons, the markers start repeating. Rather than creating a color palette with 35 different colors, I prefer doing like the graph I saw in the video, changing the shape and color for the marker for every few season plots. And here's the problem, I can't figure how to do this! Please help me
All you need to do is add the style parameter as I have done below:
The chart will look like: