Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 540dc7f

Browse files
committed
Stack Plots - matplotlib series
1 parent af72e24 commit 540dc7f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎StackPlots/demo.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from matplotlib import pyplot as plt
2+
3+
plt.style.use("fivethirtyeight")
4+
5+
minutes = [1, 2, 3, 4, 5, 6, 7, 8, 9]
6+
7+
player1 = [8, 6, 5, 5, 4, 2, 1, 1, 0]
8+
player2 = [0, 1, 2, 2, 2, 4, 4, 4, 4]
9+
player3 = [0, 1, 1, 1, 2, 2, 3, 3, 4]
10+
11+
labels = ['player1', 'player2', 'player3']
12+
colors = ['#6d904f', '#fc4f30', '#008fd5']
13+
14+
plt.stackplot(minutes, player1, player1, player2, labels=labels, colors=colors)
15+
plt.legend(loc='upper right')
16+
plt.title("My Stack Plot")
17+
plt.tight_layout()
18+
plt.savefig('plot.png')
19+
plt.show()

‎StackPlots/plot.png

33 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /