How to prevent the elongated plot when using tiled layout for image and plot

2 ビュー (過去 30 日間)
Daigo
Daigo 2022 年 11 月 26 日
回答済み: the cyclist 2022 年 11 月 26 日
When I align an image and a plot in tiled layout, the plot tends to become "elongated" as shown in an example below. Is there any good way to prevent this?
[X,Y,Z] = peaks(20);
figure;
tiledlayout(1,2);
nexttile; imagesc(Z); daspect([1 1 1]);
nexttile; surf(X,Y,Z);

採用された回答

the cyclist
the cyclist 2022 年 11 月 26 日
There are a few ways you can manipulate this. Here is one way, using the daspect command you used before:
[X,Y,Z] = peaks(20);
figure;
tiledlayout(1,2);
nexttile; imagesc(Z); daspect([1 1 1]);
nexttile; surf(X,Y,Z); daspect([1 1 2.5])
You could also use axis square:
[X,Y,Z] = peaks(20);
figure;
tiledlayout(1,2);
nexttile; imagesc(Z); daspect([1 1 1]);
nexttile; surf(X,Y,Z); axis square
I think the view command might also be handy, if you are looking for a particular perspective.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by