2

I've written a code and it gives me 3 graphs(i use matplotlib) but all of them are in 1 figure like the picture:

import math
import numpy as np
import matplotlib.pyplot as plt


x = []
y = []
TaList = []
TbList = []
for i in range(0, 21):
if i != 0 :
    a = (i/2)
    x.append(a)
    b = (math.sqrt(((4.01+40*(a))/40.2)**2 - (a**2)))
    y.append(b)
    alpha = math.atan(b/a)
    beta = math.atan(b/(20-a))
    Ta = (800/((math.tan(beta)*(math.cos(alpha)) + math.sin(alpha))))
    TaList.append(Ta)
    Tb = (800/((math.tan(alpha)*(math.cos(beta)) + math.sin(beta))))
    TbList.append(Tb)



plt.plot(x, y)
plt.plot(x, TaList)
plt.plot(x, TbList)

plt.show()

figure

so my question is how can i seperate these 3 graphs into 3 different figures? i mean i don't want them to be together in 1 picture! i want them in 3 different pictures and each alone !

  • 1
    [Similar question](https://stackoverflow.com/questions/46615554/how-to-display-multiple-images-in-one-figure-correctly/46616645) – kist Apr 24 '20 at 11:05

1 Answers1

-1

I think you need to take the

plt.plot(x, y)
plt.plot(x, TaList)
plt.plot(x, TbList)
plt.show()

out of your loop. Then, after the loop, plot each one separately like

plt.plot(x, y)
plt.show()

plt.plot(x, TaList)
plt.show()

plt.plot(x, TbList)
plt.show()
Eric M
  • 1,360
  • 11
  • 19