I draw two plot_wireframe in a single figure. I am new to matplotlib.. I read the tutorial but still have some problems.
(1) How can I change the color of lines and add legend in the figure?
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
ax.legend("View window") # not correct.
To set the colour or adjust the legend label, set this directly in the plotting call:
fig = plt.figure() ax = fig.add_subplot(111,projection='3d') ax.plot_wireframe(x,y,z1, color='r', label='View window') ax.plot_wireframe(x,y,z2, color='c', label='High window') ax.legend() # call this to actually show the legend; but use label above to set the text. plt.show()
If you read the documentation for plot, you'll see the dozens of options you can normally include to almost every plotting function in matplotlib, as well as the various linestyles and colours.
I don't know about the updating on rotation with the mouse; that may have to do with the drawing backend that matplotlib uses. If possible, you can try another backend and see if that works (a bit more on backends; no guarantee this will work).