I am trying to get a hold on Plots.jl capability to plot meshes. The mesh3d
seems to be the good choice for that.
With the following example, I manage to plot a uniformly colored mesh with the plotlyjs
backed.
using Plots;
plotlyjs();
u1 = LinRange(0, 2 * pi, 100) .* ones(100)'
v1 = (LinRange(0, 2 * pi, 100) .* ones(100)')'
u2 = sin.(u1) .* sin.(v1)
nl, nc = size(u1)
mesh3d(vec(u1), vec(v1), vec(u2))
However, the vertexcolor
parameter that should be used to pass a color to each point seems not to work as mesh3d(vec(u1), vec(v1), vec(u2), c = :red)
expectedly returns a red mesh, but mesh3d(vec(u1), vec(v1), vec(u2), c = :red, vertexcolor = vec(u2))
too.
An attempt to provide a 3-column matrix of numbers in (0-255) failed as well mesh3d(vec(u1), vec(v1), vec(u2), vertexcolor = rand(size(u2,1),3)*255)
Does somebody have a clued how this should be done ?
Note : I know I could plot the surface with surface(LinRange(0, 2 * pi, 100), LinRange(0, 2 * pi, 100),u2)
but it is not the point here because my end goal is to plot a surface with a non rectangular grid, which does not work with surface
.