Multiple Views in same figure.
14 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2018 年 9 月 15 日
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])
回答 (1 件)
Walter Roberson
2017 年 10 月 14 日
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 件のコメント
Walter Roberson
2017 年 11 月 3 日
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, ....)
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!