Multiple Views in same figure.

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 Kommentar

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])

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 14 Okt. 2017

0 Stimmen

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 Kommentare

jaykrushna Patel
jaykrushna Patel am 14 Okt. 2017
Thanks..I will look into it. temporarily I used Copyobj function to copy my plot into subplots.
Matheus Spedaletti
Matheus Spedaletti am 2 Nov. 2017
Hello jaykrushna
I am trying to do the exact same thing. Could you please explain how you used Copyobj?
Thank you
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 am 15 Sep. 2018
Note: warp() is useful for images.

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 13 Okt. 2017

Kommentiert:

am 15 Sep. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by