Borrar filtros
Borrar filtros

3D plot with colored planes

8 visualizaciones (últimos 30 días)
Atom
Atom el 20 de Oct. de 2012
Comentada: LO el 7 de Mzo. de 2021
I use
plot3(x,y,z, 'b')
box on
for plotting a 3D system. I want the faces of xy-plane, yz-plane and zx-plane to be colored by blue, red and white respectively.
Please suggest me the code. Thanks in advance.

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de Oct. de 2012
You can determine the axis sizes by get(gca, 'XLim') and YLim and ZLim. Using those values, you can create patch() objects that are rectangles in 3-space with the colors you want.
  3 comentarios
Walter Roberson
Walter Roberson el 20 de Oct. de 2012
XL = get(gca, 'XLim');
YL = get(gca, 'YLim');
patch([XL(1), XL(2), XL(2), XL(1)], [YL(1), YL(1), YL(2), YL(2)], [0 0 0 0 0], 'FaceColor', [0 1 0]);
LO
LO el 7 de Mzo. de 2021
typo: there is a 5th 0 in your Z vector that you do not need

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by