Python/Matplotlib三维图形的极限

2024-06-16 10:21:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个问题,当设置轴限制的三维图形。 我用熊猫来读取我的数据库文件,这些文件只是大气流量和风速的数字(float64格式)。 但是当设置一个极限时,比如1200雷和80公里/小时的风速,我的图刚好超过了期望的表面。 它发生在“ax.set\u xlim3d”、“ax.set\u xlim”和“plt.xlim”中

我的代码如下:

fig = plt.figure()
ax = fig.gca(projection='3d')
y = dados['Rajada']
x = dados['Raios']
z = ((1/3080)*(np.exp(2.2507716+(0.0011096*x)+(0.0274958*y))))
ax.set_xlabel('Número de Raios',fontsize=15)
ax.set_ylabel('Rajada Máxima em Km/H',fontsize=15)
ax.set_zlabel('Taxa de Falha por Quilômetro',fontsize=15)
plt.xlim(0,1200)
plt.ylim(0,80)
surf = ax.plot_trisurf(x, y, z, cmap='coolwarm',hatch='/-', edgecolor='none')

Image of how the graph was plotted


Tags: 文件数据库图形figdepltax大气