Issue
Hi I am experiencing subplotting in a loop. I failed to plot with using below code. The bottom subplot is empty
x=[1,2,3]
y=[4,5,6]
fig, ax = plt.subplots(2,1, sharex = True)
for n in range(2):
ax[n].plot(x,y)
plt.show()
the failed plot looks like this. Any thoughts?
Solution
Move plt.show()
outside the for loop:
for n in range(2):
ax[n].plot(x,y)
plt.show()
Answered By - 9769953
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.