I'd like to be able to rotate the view of a hemisphere in a 3D matplotlib plot and have the shape show correctly,
Answers to set matplotlib 3d plot aspect ratio? used in the first example don't help as they address the aspect ratio of the plot window.
Question: In the second example I show that if I make the scales equal lengths (-1, 1), (-1, 1), (-0.5, 1.5) I can preserve the shape as I rotate the view, but is this the only way to preserve the shape under view rotation?
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
points = np.random.random((3, 1000)) - 0.5
points /= np.sqrt((points**2).sum(axis=0))
x, y, z = points[:, points[2] > 0.] # upper hemisphere
fig = plt.figure(figsize=plt.figaspect(0.5)) # https://stackoverflow.com/a/12371373/3904031
ax1 = fig.add_subplot(2, 1, 1, projection='3d')
ax1.plot(x, y, z, '.k')
ax1.view_init(0, 90)
ax1.set_title('view_init(0, 90)', fontsize=16)
ax2 = fig.add_subplot(2, 1, 2, projection='3d')
ax2.plot(x, y, z, '.k')
ax2.view_init(90, 0)
ax2.set_title('view_init(90, 0)', fontsize=16)
plt.show()
fig = plt.figure()
ax1 = fig.add_subplot(1, 2, 1, projection='3d')
ax1.plot(x, y, z, '.k')
ax1.view_init(0, 90)
ax1.set_title('view_init(0, 90)', fontsize=16)
ax1.set_xlim(-1.0, 1.0)
ax1.set_ylim(-1.0, 1.0)
ax1.set_zlim(-0.5, 1.5)
ax2 = fig.add_subplot(1, 2, 2, projection='3d')
ax2.plot(x, y, z, '.k')
ax2.view_init(90, 0)
ax2.set_title('view_init(90, 0)', fontsize=16)
ax2.set_xlim(-1.0, 1.0)
ax2.set_ylim(-1.0, 1.0)
ax2.set_zlim(-0.5, 1.5)
plt.show()