Thursday, 19 December 2019

matplotlib stack plot

from matplotlib import pyplot as plt

minutes = range(1,10)

player1 = [1,2,3,3,4,4,4,4,5]
player2 = [1,1,1,1,2,2,2,3,4]
player3 = [1,1,1,2,2,2,3,3,3]

labels = ['player1', 'player2', 'player3']

plt.stackplot(minutes, player1, player2, player3, labels=labels)

plt.legend(loc='upper left')

plt.title('total score by time')
from matplotlib import pyplot as plt

minutes = range(1,10)

player1 = [8,6,5,5,4,2,1,1,0]
player2 = [0,1,2,2,2,4,4,4,4]
player3 = [0,1,1,1,2,2,3,3,4]

labels = ['player1', 'player2', 'player3']

plt.stackplot(minutes, player1, player2, player3, labels=labels)

plt.legend(loc=(0.07,0.05))

plt.title('total score by time')
reference:

No comments:

Post a Comment