By default, building a set of points (or any other) in 3D with matplotlib defines the z axis vertically, as shown here (code below):

I need to swap the z axis and y axis so that the y axis is shown vertically.
I looked around, but did not find a way to tell matplotlib for this.
Add: I do not want to resort to a hacker, where I change data and tags. This is a simple 3-point 3D plot, but I have to build much more complex surfaces. I am looking for a general solution, not just what works with scatter. An easy way to tell matplotlib put the y axis vertically instead of the z axis is a clean way to do this.
MWE
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) ax.scatter([0.2, 0.5, 0.8], [2.3, 0.47, 1.], [2.1, 5.3, 0.7]) ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z') plt.show()
source share