Surface plot

There is no doubt a very simple answer to this that I’ve overlooked. How would one plot a surface x=y, where z is any real number?

Which plotting library are you asking about? Have you tried googling or searching the forum? For me the first google hit is:

and the second is:

Yes, thank you I’ve seen that. It explains what to do when z=something. I am asking for the specific case where the plane is defined with two variables x=y.

Sorry it seems I don’t really understand what you’re asking. The last example of the SO answer is:

julia> x = y = 0:0.1:10
0.0:0.1:10.0

julia> z = f.(x', y) ; # note the ' which permutes the dims of x

julia> surface(x, y, z)

so here indeed x=y. Could you maybe elaborate a little on what it is you’re trying to do and what’s going wrong?

In 3D space, x=y is a vertical plane. Using Plots.jl’s plotlyjs backend, one way to plot vertical surfaces is shown in this other post. I think you just need to apply a trivial 45 degrees rotation to the vertical plane meshes shown, in order to obtain the x=y surface.

There is an implicit 3D plotting package that provides a more elegant solution.

In my example z cannot be defined as a function but rather is simply any real value and the plane is entirely defined by x=y. In this case what should replace the f.(x’,y)? Thank you for trying to help me.

Thank you for pointing me to this package. It looks like it might be a good solution:

using Implicit3DPlotting
f(x) = x[1]-x[2]
plot_implicit_surface(f; transparency=true)

Improving the way the plot looks is tricky and was hoping for something that could be overlaid onto existing plots.

Each plane can be plotted as a parameterized surface.
In particular, x=y, can be parameterized as:

x=u
y=u,
z=v

where u and v belong to some intervals.
Example:

using PlotlyJS
ul= range(-1, 1, length=10)
vl= range(0, 0.75, length=8)
u= [s for t in vl, s in ul]
v= [t for t in vl, s in ul]
pl= Plot(surface(x=u, y=u, z=v, colorscale=[[0, "#ADD8E6"], [1,  "#ADD8E6"]], 
         showscale=false),
         Layout(width=500, height=400, scene_camera_eye=attr(x=1.95, y=1, z=0.75)))

planexeqy

3 Likes

The implicit 3D plotting package uses Makie.jl and you can ask questions in this forum and the experts will guide you. If the existing plots are also in Makie, I guess the overlaying should be possible.

Thank you, this is perfect for what I was looking for.