Skip to content

Instantly share code, notes, and snippets.

@busterroni
Last active March 19, 2016 21:27
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 busterroni/1eff7ecbf96eda2be349 to your computer and use it in GitHub Desktop.
Save busterroni/1eff7ecbf96eda2be349 to your computer and use it in GitHub Desktop.
import json, plotly.plotly as plotly
with open("tagpromatches.json") as f: #you can get the match data here: https://tagpro.eu/?science
data=json.load(f)
redWins=0
blueWins=0
ties=0
for match in data.values():
redScore=match['teams'][0]['score']
blueScore=match['teams'][1]['score']
if redScore>blueScore:
redWins+=1
elif blueScore>redScore:
blueWins+=1
elif blueScore==redScore:
ties+=1
fig= {
'data': [{
'labels': ['Red', 'Blue', 'Tie'],
'values': [redWins, blueWins, ties],
'marker': {'colors': ['rgb(250, 0, 0',
'rgb(51, 51, 255',
'rgb(192, 192, 192']},
'type': 'pie',
}],
'layout': {'title': 'TagPro Team Win Distribution'}
}
plotly.plot(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment