Last active
March 19, 2016 21:27
-
-
Save busterroni/1eff7ecbf96eda2be349 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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