Below is some code which uses a callback to print out the current azimuthal and elevation angles, as well as append them to a list for further use later. These details are kept in ax3d.azim
and ax3d.elev
respectively.
Everytime you release your mouse button it will call on_click
. This will allow you to simply rotate your graph to your chosen rotation and then save the projection.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
mol=np.random.rand(6,3)*10.0
fig3d = plt.figure(figsize = ( 6.5, 6.5 ) )
fig3d.canvas.set_window_title('3D')
ax3d = fig3d.gca(projection='3d')
ax3d.scatter(mol[:,0], mol[:,1], mol[:,2], s=200)
# List to save your projections to
projections = []
# This is called everytime you release the mouse button
def on_click(event):
azim, elev = ax3d.azim, ax3d.elev
projections.append((azim, elev))
print(azim, elev)
cid = fig3d.canvas.mpl_connect('button_release_event', on_click)
plt.show()