简体   繁体   中英

How to get y-axis inverted to share a common original point with x-axis for 3D plot in matplotlib?

I would like to get the y-axis inverted to share a common original point with x-axis,the x-axis can be inverted, but the y-axis can be set like x-axis,so could any one give me some suggestions?the wanted result is shown in the picture.

import mpl_toolkits.mplot3d
ax = plt.gca(projection = '3d')
ax.set_title('3d_image_show')

ax.set_xlabel('X')  
ax.set_ylabel('Y')  
ax.set_zlabel('Z')  
ax.view_init(elev=20, azim=45)
ax.invert_xaxis()
ax.invert_yaxis()

enter image description here

Change azim to -135 (comes from 45-180 , 45 is from your code), and no need to invert the axes.

import mpl_toolkits.mplot3d

fig = plt.figure()
ax = plt.gca(projection = '3d')
ax.set_title('3d_image_show')

ax.set_xlabel('X')  
ax.set_ylabel('Y')  
ax.set_zlabel('Z')  
ax.view_init(elev=20, azim=-135)

output: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM