Changes

Jump to navigation Jump to search
556 bytes added ,  17:00, 12 February 2022
m
Line 110: Line 110:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
=== Pie ===
+
===Pie===
 
<syntaxhighlight lang="python3">
 
<syntaxhighlight lang="python3">
 
from matplotlib import pyplot as plt
 
from matplotlib import pyplot as plt
Line 125: Line 125:     
plt.title("My Awesome Pie Chart")
 
plt.title("My Awesome Pie Chart")
 +
plt.tight_layout()
 +
plt.show()
 +
</syntaxhighlight>
 +
 +
=== Stack ===
 +
<syntaxhighlight lang="python3">
 +
 +
from matplotlib import pyplot as plt
 +
 +
plt.style.use("fivethirtyeight")
 +
 +
 +
minutes = [1, 2, 3, 4, 5, 6, 7, 8, 9]
 +
 +
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']
 +
colors = ['#6d904f', '#fc4f30', '#008fd5']
 +
 +
plt.stackplot(minutes, player1, player2, player3, labels=labels, colors=colors)
 +
 +
plt.legend(loc=(0.07, 0.05))
 +
 +
plt.title("My Awesome Stack Plot")
 
plt.tight_layout()
 
plt.tight_layout()
 
plt.show()
 
plt.show()
 
</syntaxhighlight>
 
</syntaxhighlight>

Navigation menu