[英]Rotate 3d plot to look like 2d plot (no perspective)
I have created a 3d plot and want it to rotate so that the observer looks straight onto the yz-plane.我创建了一个 3d plot 并希望它旋转,以便观察者直视 yz 平面。 I used
ax.view_init(0,360)
for this rotation but there is still some perspective, as you can see in the second picture.我使用
ax.view_init(0,360)
进行此旋转,但仍有一些透视,如您在第二张图片中所见。 In a 2D plot the maroon and orange colored plots would meet exactly in the middle of the red plot as can be seen in the third picture.在 2D plot 中,栗色和橙色图将恰好在红色 plot 的中间相遇,如第三张图片所示。 I intend to animate this rotation, and want to seemlessly continue with a 2D plot after the rotation, so ideally it would be possible to get rid of the perspective in this 3d environment, because I'm having a hard time matching the style of the 3d plot with a 2d plot.
我打算为这个旋转设置动画,并希望在旋转后无缝地继续使用 2D plot,所以理想情况下,可以在这个 3d 环境中摆脱透视,因为我很难匹配3d plot 带有二维 plot。
I'd like to post a complete example but you didn't help very much (no MVE), however you can specify the projection type when you instantiate the axes:我想发布一个完整的示例,但您并没有太大帮助(没有 MVE),但是您可以在实例化轴时指定投影类型:
In [6]: import matplotlib.pyplot as plt
...: from mpl_toolkits.mplot3d import Axes3D
...: %matplotlib
...:
...: ax = plt.axes(projection='3d', proj_type='ortho')
...: ax.view_init(0,360)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.