Julia PyPlot:绘制3D表面,其表面颜色为表面渐变的标准颜色 [英] Julia PyPlot: plot 3D surface with as face colors the norm of surface gradient

查看:152
本文介绍了Julia PyPlot:绘制3D表面,其表面颜色为表面渐变的标准颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用Julia的Pyplot绘制3D曲面,例如 表面渐变是人脸的颜色?

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?

类似于Python的本主题:带有表面的彩色matplotlib plot_surface命令渐变

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

推荐答案

我看到了这个,我只是想让它工作.使用PyPlot后端几乎可以通过Plots.jl对其进行支持.我只需要换一个自定义的matplotlib着色器即可应用不同的z-matrix.

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.

您会注意到,我正在访问numpy的渐变函数(通过PyCall导入),并且包装了渐变矩阵(G),以免将其切成列.总而言之……比python示例要简单得多!

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!

注意:在合并/标记之前,您必须检出Plot的dev分支:Pkg.checkout("Plots","dev")

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

这篇关于Julia PyPlot:绘制3D表面,其表面颜色为表面渐变的标准颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆