Skip to content

Instantly share code, notes, and snippets.

@cavedave
Created March 28, 2018 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cavedave/52febd2f02e0bcbff1afdf1eed1ba7a4 to your computer and use it in GitHub Desktop.
Save cavedave/52febd2f02e0bcbff1afdf1eed1ba7a4 to your computer and use it in GitHub Desktop.
Does Carlsen just grind out wins against Caruana? I got their games from http://www.chessgames.com/perl/chess.pl?page=1&pid=52948&pid2=76172
plt.figure(figsize=(10,6))
colors = {'draw':'orange', 'win':'green', 'loss':'red'}
#h=df['result'].apply(lambda x: colors[x])
#c=df['result'].apply(lambda x: colors[x])
#swarm_plot = sns.swarmplot(y='Moves', x='Year', hue='result', data=df)
muted = ["#27e833", "#e7b416", "#cc3232"]
newPal = dict(win = muted[0], draw = muted[1], loss = muted[2])
#sns.swarmplot(x="measurement", y="value", hue="species", data=iris,palette=newPal )
swarm_plot = sns.swarmplot(y='Moves', x='Year', hue="result", data=df, palette=newPal)
plt.legend(bbox_to_anchor=(1, 1), loc=2,title='Carlsen')
plt.title('Carlsen Against Caruana')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment