PYTHON Tutorial
pyplot.figure()
.pyplot.subplots()
.pyplot.subplot()
.pyplot.plot()
eller andra ritfunktioner.import matplotlib.pyplot as plt
# Skapa en figur och dela upp den i 2x2 delplottar
fig, subplots = plt.subplots(2, 2)
# Välj och rita på delplott 1,1
plt.subplot(subplots[0, 0])
plt.plot([1, 2, 3], [4, 5, 6])
# Välj och rita på delplott 1,2
plt.subplot(subplots[0, 1])
plt.plot([7, 8, 9], [10, 11, 12])
# Välj och rita på delplott 2,1
plt.subplot(subplots[1, 0])
plt.plot([13, 14, 15], [16, 17, 18])
# Välj och rita på delplott 2,2
plt.subplot(subplots[1, 1])
plt.plot([19, 20, 21], [22, 23, 24])
# Visa figuren
plt.show()
GridSpec
för att skapa mer komplexa layouter.pyplot.subplots_adjust()
.pyplot.legend()
för att lägga till legender.