Borrar filtros
Borrar filtros

Multiple Views in same figure.

8 visualizaciones (últimos 30 días)
jaykrushna Patel
jaykrushna Patel el 13 de Oct. de 2017
Comentada: Walter Roberson el 15 de Sept. de 2018
I am working on the project which creates a 3D plot as shown in the figure. I know about View() command to switch between the view. So I can plot 3D plots and 2D plots in XY and YZ plane. But is there any way that I can add all three views in the same figure?
<<
>>
I want all 3 outputs in the same figure. My final aim is to create an animation. So I don't want to plot everything 3 times as the subfigure.
  1 comentario
Walter Roberson
Walter Roberson el 15 de Sept. de 2018
Basically, plot something, invoke the rotation tool, grab it and start moving. The current view will be displayed interactively on the plot (and will probably stop being displayed when you release the mouse.) When you are satisfied,
[p,q] = view()
and read off the p and q values, and insert them in your code in the form
view([p,q])

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de Oct. de 2017
To display 2D graphics combined with 3D graphics, you need to do one of these things:
  • when possible, if there is a 3D equivalent to the 2D routine you used for the plotting, use the 3D equivalent and set the Z to a constant matrix of appropriate value. This in itself only works for data that is to be shown aligned with the X/Y plane, but can be combined with the below; or
  • parent the 2D graphics to a hgtransform and set the transform matrix to move and rotate it to the desired 3D position; or
  • for images, create a surf or patch that uses texture-mapping to display onto a flat surface in 3D. This is required if you want to rotate an image out of the X-Y plane: images are 2D objects that if you hgtransform will disappear showing only their edge.
  4 comentarios
Walter Roberson
Walter Roberson el 3 de Nov. de 2017
main_ax = subplot(2,5,[1 2 3 4 6 7 8 9]);
sideax1 = subplot(2,5,5);
sideax2 = subplot(2,5,10);
axes(main_ax)
... do your drawing ...
ac = get(main_ax, 'Children'); %no hidden objects
copyobj( ac, sideax1 );
set(sideax1, 'xlim', ..., 'ylim', ...', 'zlim', ...)
view(sideax1, alt1, ax1 )
xlabel(sideax1, ...)
ylabel(sideax1, ...)
zlabel(sideax1, ...)
title(sideax1, ....)
copyobj( ac, sideax2 );
set(sideax2, 'xlim', ..., 'ylim', ...', 'zlim', ...)
view(sideax2, alt2, ax2 )
xlabel(sideax2, ...)
ylabel(sideax2, ...)
zlabel(sideax2, ...)
title(sideax2, ....)
Walter Roberson
Walter Roberson el 15 de Sept. de 2018
Note: warp() is useful for images.

Iniciar sesión para comentar.

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by