1

I used matplotlib to plot a 3d figure

def showlab(dic, title): 
    global driehoeken
    fig = plt.figure() 
    ax = fig.add_subplot(111, projection = '3d') 
    lijst = np.array(driehoeken)
    lijst = np.around(lijst, 2)
    poly3d = [[lijst[i, j*3:j*3+3]for j in range(3)]for i in range(lijst.shape[0])]
    ax.add_collection3d(Poly3DCollection(poly3d, linewidth = 1)) 
    ax.set_xlim(0, 100) 
    ax.set_xlabel('l') 
    ax.set_ylim(-150, 150) 
    ax.set_ylabel('a')
    ax.set_zlim(-150, 150)
    ax.set_zlabel('b') 
    plt.title(title)
    plt.show()

This plot a figure with the 'b' axis pointed upwards. But I want to have the 'l' axis pointed upwards, but keep the right hand rule. Is there a easy way to do this?

  • Does this answer your question? [How to invert the x or y axis](https://stackoverflow.com/questions/2051744/how-to-invert-the-x-or-y-axis) – normanius Oct 24 '22 at 10:16

1 Answers1

1

You can reverse the axis just setting the limits in the proper order:

ax.set_xlib(100, 0)

There's a similar question in StackOverflow: Reverse Y-axis in PyPlot

tbarreno
  • 76
  • 1
  • 5