I know this is kind of old, but I implemented this functionality using mesh3d:
function fill_between3d(x1, y1, z1, x2, y2, z2)
n = length(x1)
x = [x1; x2]
y = [y1; y2]
z = [z1; z2]
bottom_edge = 0:n-2
top_edge = 1:n-1
connect1 = [[i for i ∈ bottom_edge]; [2n-i for i ∈ top_edge]]
connect2 = [[i+1 for i ∈ bottom_edge]; [2n-i-1 for i ∈ top_edge]]
connect3 = [[n+i+1 for i ∈ bottom_edge]; [n-i-1 for i ∈ top_edge]]
connect = (connect1, connect2, connect3)
return (x, y, z, connect)
end
Then with GR backend:
x = 0.:0.05:3;
y = 0.:0.05:3;
z = @. sin(x) * exp(-(x+y))
gr()
plot3d(zero(x), y, z; linecolor=:blue, linewidth=2, label=nothing)
plot3d!(x, y, z; linecolor=:red, linewidth=2, label="data")
meshx, meshy, meshz, connections = fill_between3d(x, y, z, x, y, zero(z))
# linewidth=0. is only necessary for gr() backend it seems...
mesh3d!(meshx, meshy, meshz, connections=connections, color=:red, alpha=0.4, linewidth=0., label=nothing)
# for pgfplotsx():
# mesh3d!(meshx, meshy, meshz, connections=connections, color=:red, fill_opacity=0.4, draw_opacity=0., label=nothing)
plot3d!(x, zero(y), z; linecolor=:green, linewidth=2, label=nothing)
and with some other backends:
plotlyjs()
:
pythonplot()
:
pgfplotsx()
:
This required a couple extra parameters in the call to mesh3d
to enable the transparency and hide the mesh grid-lines
mesh3d!(meshx, meshy, meshz, connections=connections, fill_opacity=0.4, draw_opacity=0., color=:red)