No, it doesn't work. I'm using this method for the 3D plot: https://scicomp.stackexchange.com/questions/26739/plot-2d-piecewise-constant-in-matlab-in-a-finite-elements-mesh
Same aspect ratio for the z-axis in a surface plot
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alexandra Roxana
am 8 Jun. 2023
Bearbeitet: Alexandra Roxana
am 10 Jun. 2023
I have a surface plot
and the x-axis and y-axis have the same ratio. I wish for the z-axis to have the same ratio. I have used
daspect ([1 1 1])
but it turns into a 2D plot.
I have used this code for the same aspect ratio for the x-axis and y-axis.
h=get(gca,'DataAspectRatio');
if h(3)==1
set(gca,'DataAspectRatio',[1 1 1/max(h(1:2))])
else
set(gca,'DataAspectRatio',[1 1 h(3)])
end
3 Kommentare
Mathieu NOE
am 9 Jun. 2023
maybe you get a 2D plot because the range of your z axis is 1000 times smaller than the range of x, y axes
Akzeptierte Antwort
Simon Chan
am 10 Jun. 2023
As mentioned by Mathieu NOE in the comment section, your z-axis data is 1000 times smaller than the range of x and y-axes data. Hence the ratio between them should be rescale accordingly.
Check whether this is what you want or not.
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surface(X/5+1,Y/3.5,Z*1e-3) % Just make sure the range of the demo data is close to your data
view(3)
daspect ([1 1 1e-3]);
10 Kommentare
Simon Chan
am 10 Jun. 2023
Glad to see you come up with a new idea. Just curious your data along z-axis is also in time unit?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!