 # Fill a curve in 3D

I want to plot a complex impedance value as a function of frequency.

This results in a line in 3D(real, imaginary, frequency).
How do I fill the area between the line and the z=0 coordinate in 3D.
I tried fillrange and ribbon, but I could not get it to work in Plots.jl

Something like this can be found on page 295:

1 Like

In PGFPlotsX, I would suggest this example as a starting point:

https://kristofferc.github.io/PGFPlotsX.jl/dev/examples/gallery.html#D-Waterfall-1

I am not aware of something similar for Plots.jl, but see the original topic:

1 Like

Don’t know if it applies, but in Gnuplot.jl is quite easy:

``````x = 0.:0.05:3;
y = 0.:0.05:3;
z = @. sin(x) * exp(-(x+y))

using Gnuplot
@gsp xlab="X" ylab="Y" linetypes(:Set1_5, lw=3) :-
@gsp :- "set style fill transparent solid 0.3" :-
@gsp :- "set xyplane at 0" "set grid" :-
@gsp :- x y z z.*0 z "w zerror t 'Data'" :-
@gsp :- x.*0 y z "w l notit" :-  # projection on x=0
@gsp :- x y.*0 z "w l notit"     # projection on y=0
save(term="pngcairo", output="output.png")
`````` 11 Likes

Nice, what about increase transparency in the shaded area (area_gradient)? As in here: https://vega.github.io/vega-lite/examples/area_gradient.html

Is this possible with a plots backend? I want to draw in 3D space a 2D polygon so that the disk or ellipse can be rotated. All I am able to get is an unfilled line. Same commands create a filled shape if 2D points are used. Where do I need to look?

2 Likes

Right, how to do this with Plots.jl? This can be don in 2D using `plot(x, y, fillrange=0)`, but this doesn’t work in 3D.

1 Like