我有一个关于如何将散点图和线正确地放置到一个图中的问题。你知道吗
代码如下:
import numpy as np
import matplotlib.pyplot as plt
t= np.linspace(60, 180,100)
ax= plt.subplot()
ax.plot(data.Weight, data.Height , color = 'red')
ax.plot(t, 60+ 0.05*t, label=r"$Height = 60+ 0.05*Weight$")
ax.plot(t, 50+ 0.16*t, label=r"$Height = 50+ 0.16*Weight$")
ax.set_xlabel(r'$Weight$', fontsize=12)
ax.set_ylabel(r'$Height$', fontsize=12)
ax.set_title('Dependence')
plt.show()
可以看到散点图反射不正确(显示为线)
谢谢你!你知道吗
{假设要在cd1中显示变量^}
将
data.Weight
分散在data.Height
上:相关问题 更多 >
编程相关推荐