Permalink
Browse files

add difference line

  • Loading branch information...
1 parent f150ca4 commit ebb7c218d8a8e259bed6329dc5988cce116d4c4f @depesz committed Apr 8, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 kanasta/__init__.py
View
@@ -280,17 +280,19 @@ def game_graph(game_id):
x = [0] + [int(r['deal_no']) for r in deals]
team1 = [0] + [int(r['pair1_sum']) for r in deals]
team2 = [0] + [int(r['pair2_sum']) for r in deals]
+ team_diff = [ abs(i[0]-i[1]) for i in zip(team1, team2) ]
team1_label = '%s + %s' % (game['pair1_player1'], game['pair1_player2'])
team2_label = '%s + %s' % (game['pair2_player1'], game['pair2_player2'])
- min_range = min(team1 + team2)
- max_range = max(team1 + team2)
+ min_range = min(team1 + team2 + team_diff)
+ max_range = max(team1 + team2 + team_diff)
guide_lines = [i for i in (0, 2500, 5000, 10000) if min_range <= i <= max_range]
fig = Figure(facecolor="white")
ax = fig.add_subplot(111, axis_bgcolor="#eeeeee")
ax.plot(x, team1, color='red', linestyle='-', linewidth=2, label=team1_label)
ax.plot(x, team2, color='blue', linestyle='-', linewidth=2, label=team2_label)
+ ax.plot(x, team_diff, color='magenta', linestyle='--', linewidth=1, label=u'różnica')
for i in guide_lines:
ax.axhline(y=i, linewidth=1, color='green')

0 comments on commit ebb7c21

Please sign in to comment.