matplotlib surface example not working
-
this example: https://matplotlib.org/mpl_examples/mplot3d/surface3d_demo3.py
when run from pythonista, does not plot as in the doc.
It should show
but the result is very different.
Is there any solution?
thanks.
-
Hi, most likely it is due to different version of Pythonista matplotlib compared to the version you use in your computer or the version used to produce the image of the example. Pythonista matplotlib version is 1.4.0.
However for 3D graphs (xyz) I would not use Pythonista, for them I'd use other apps (like for example Visual Math 4D, I apologize for mentioning it in this forum).
-
thanks for the answer.
I’ve just found that this example is in pythonista doc with a small change (the commented line is replaced by the next one)#surf = ax.plot_surface(X, Y, Z, facecolors=colors, linewidth=0) surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=colors, linewidth=0, antialiased=False)
then it works!
-
@jmv38 Very good and good to know, bye
-
I just checked and this example (both the original and edited forms) crashes immediately on the latest version of Pythonista on my iPad Pro running IOS 12.2.
-
The code in the original post works for me in the current beta. Please try rebooting the Pythonista app.
-
@jmv38 @ccc this should be a pretty simple fix... it's been a prevalent issue for over a year now that any graphing having to do with matplotlib running on python 2.7 will crash the pythonista app. Switching to python 3 and running the script should sort any problems.