开发者

I'm not able to adjust the view_init to get the desired outcome

开发者 https://www.devze.com 2022-12-07 21:47 出处:网络
I\'ve played around with ax.view_init and for some reason, I can get every other image except for this one:

I've played around with ax.view_init and for some reason, I can get every other image except for this one:

I'm not able to adjust the view_init to get the desired outcome

Here's my code from the other 3 subplots:

from mpl_toolkits import mplot3d


xdata = list(data["x"])
ydata = list(data["y"])
zdata = list(data["z"])


fig = plt.figure(figsize=(50,100))



#subplot 1
ax = fig.add_subplot(2,2,1,projection='3d')
ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap='jet', marker='o')
ax.view_init(1,90)

ax.set_xlabel('x', color='#8C000F', size=20)
ax.set_ylabel('y', color='#8C000F', size=20)
ax.set_zlabel('z', color='#8C000F', size=20)

plt.show()

xdata = list(data["x"])
ydata = list(data["y"])
zdata = list(data["z"])


fig = plt.figure(figsize=(50,100))



#subplot 3
ax = fig.add_subplot(2,2,3,projection='3d')
ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap='jet', marker='o')
ax.view_init(30,40)

ax.set_xlabel('x', color='#8C000F', size=20)
ax.set_ylabel('y', color='#8C000F', size=20)
ax.set_zlabel('z', color='#8C000F', size=20)

plt.show()

xdata = list(data[开发者_如何转开发"x"])
ydata = list(data["y"])
zdata = list(data["z"])


fig = plt.figure(figsize=(50,100))



#subplot 3
ax = fig.add_subplot(2,2,3,projection='3d')
ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap='jet', marker='o')
ax.view_init(30,40)

ax.set_xlabel('x', color='#8C000F', size=20)
ax.set_ylabel('y', color='#8C000F', size=20)
ax.set_zlabel('z', color='#8C000F', size=20)

plt.show()

This is the problem one:

#subplot 2
ax = fig.add_subplot(2,2,2,projection='3d')
ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap='jet', marker='o')
ax.view_init(1,90)

ax.set_xlabel('x', color='#8C000F', size=20)
ax.set_ylabel('y', color='#8C000F', size=20)
ax.set_zlabel('z', color='#8C000F', size=20)

plt.show()

No matter what I adjust it to, I can't seem to get it. I've tried adjusting both sides of view_init. I do need the axis to stay on the same sides they're on but I can't get it to go straight across.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号