Slice along a curved plane

It is easy to plot slices along a straight line plane (e.g. x=-50, and y=40 in the first figure) using the slice function.
[x,y,z]=meshgrid(-55:0.1:-25,30:0.1:60,1:1:150); slice(x,y,z,c,-50,40,[]); shading flat;
However, how can I get a slice along a curved plane (like the second figure)?

 Respuesta aceptada

uxsmfu
uxsmfu el 8 de Nov. de 2018

1 voto

After some digging, problem solved. I figured I should share the solution here.
The index terms (xd,yd,zd) need to be 2-D.
[yd,zd]=meshgrid(lat,depth);
[xd,zd]=meshgrid(lon,depth);
slice(x,y,z,c,xd,yd,zd);

1 comentario

Guillaume
Guillaume el 8 de Nov. de 2018
"After some digging, problem solved. I figured I should share the solution here. The index terms (xd,yd,zd) need to be 2-D."
Basically, what I already said a day earlier in my answer: "Just pass a matrix of location for your x and y slice location"
Sometimes, you wonder why bother answering questions...

Iniciar sesión para comentar.

Más respuestas (1)

Guillaume
Guillaume el 7 de Nov. de 2018

0 votos

how can I get a slice along a curved plane
Just pass a matrix of location for your x and y slice location instead of fixed -50, 40. There's even an example in the documentation of slice

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Nov. de 2018

Comentada:

el 8 de Nov. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by