How to prevent the elongated plot when using tiled layout for image and plot
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daigo
am 26 Nov. 2022
Beantwortet: the cyclist
am 26 Nov. 2022
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);
0 Kommentare
Akzeptierte Antwort
the cyclist
am 26 Nov. 2022
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
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!