Reputation: 1751
When I run this code, I do have one plot printing my two data sets a and b. I would like them to be displayed on two separate plots. Thanks in advance
import matplotlib.pyplot as plt
a = range(0,10)
b= range(2,12)
plt.plot(a)
plt.plot(b)
Upvotes: 1
Views: 66
Reputation: 50560
The tutorial shows how to do this. You need to utilize the show()
method after each plot.
plt.plot(a)
plt.show()
plt.plot(b)
plt.show()
Alternatively, you can show both at the same time utilizing subplots:
plt.subplot(2, 1, 1)
plt.plot(a)
plt.subplot(2, 1, 2)
plt.plot(b)
plt.show()
This creates the following plot:
Upvotes: 1
Reputation: 173
You can use the show()
method :
import matplotlib.pyplot as plt
a = range(0,10)
b= range(2,12)
plt.plot(a)
plt.show()
plt.plot(b)
plt.show()
Upvotes: 1