Julia PyPlot: plot 3D surface with as face colors the norm of surface gradient

可紊 提交于 2019-12-23 08:56:56

问题


Does anyone know how to plot a 3D surface with Julia's Pyplot with e.g the norm of the surface-gradient as the face color?

Similar to this topic for Python: Color matplotlib plot_surface command with surface gradient


回答1:


I saw this and I just HAD to make it work. It was almost supported out of the box with Plots.jl, using the PyPlot backend. I just had to swap out for a custom matplotlib shader to apply a different z-matrix.

You'll notice that I'm accessing numpy's gradient function (imported through PyCall), and I'm wrapping the gradient matrix (G) so that it doesn't get sliced into columns. All in all... much simpler than the python example!

Note: until I merge/tag, you'll have to checkout the dev branch of Plots: Pkg.checkout("Plots","dev")



来源:https://stackoverflow.com/questions/36925356/julia-pyplot-plot-3d-surface-with-as-face-colors-the-norm-of-surface-gradient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!