【问题标题】:How to seperate the drawn figures by matplotlibmatplotlib如何将绘制的图形分开
【发布时间】:2020-04-23 20:41:25
【问题描述】:

我编写了一个代码,它给了我 3 个图表(我使用 matplotlib),但它们都在 1 个图中,如图所示:

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

所以我的问题是如何将这 3 个图形分成 3 个不同的图形?我的意思是我不希望他们在一张照片中在一起!我想要他们在 3 张不同的照片中,每张都单独!

【问题讨论】:

标签: python matplotlib


【解决方案1】:

我认为你需要采取行动

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

脱离你的循环。然后,在循环之后,分别绘制每个像

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

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

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

【讨论】:

    猜你喜欢
    • 2017-02-13
    • 1970-01-01
    • 2022-11-10
    • 2020-03-22
    • 2016-11-08
    • 2019-09-27
    • 1970-01-01
    • 2015-04-24
    相关资源
    最近更新 更多