How to rotate domain, but the lon and lat are on the contour (not on the axis)
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
eko supriyadi
am 28 Jun. 2025
Kommentiert: Torsten
am 29 Jun. 2025
Dear all, as far we know Matlab will traditionally generate 4 white areas when using the following script on rotate domain:
figure;
p=pcolor(lon_rho,lat_rho,h2a);shading interp;
An example illustration is attached. Instead of generating a map like the illustration, I want the lon and lat to be directly placed on the generated contour, note the black numbers in the attachment (not on the matlab x and y axis). Is this possible?

and this is a perfect example of what I want to get:
2 Kommentare
Dyuman Joshi
am 28 Jun. 2025
Verschoben: Dyuman Joshi
am 29 Jun. 2025
Note that the aspect ratio of axes will get distorted as per the angle, so adjust them as per your requirement.
X = [1 2 3; 1 2 3; 1 2 3];
Y = X';
C = [3 4 5; 1 2 5; 5 5 5];
%Default orientation
pcolor(X,Y,C)
%Modified orientation
figure
axes
%rotate camera about viewing axis
camroll(30)
xlabel('X')
ylabel('Y')
%set(gca,'dataaspectratiomode','manual')
hold all
pcolor(X,Y,C)
As to why the ylabel moves to the right side, I do not know yet.
eko supriyadi
am 28 Jun. 2025
Verschoben: Dyuman Joshi
am 29 Jun. 2025
Akzeptierte Antwort
Walter Roberson
am 28 Jun. 2025
Bearbeitet: Walter Roberson
am 28 Jun. 2025
You need to first calculate the tilt angle of the valid part of the data, then rotate by the negative of that angle so that the valid part would lie along the x axis. Then draw that, and camorbit() the resulting graph to tilt the plotted axes back to the original angle.
2 Kommentare
Torsten
am 29 Jun. 2025
theta = median(angle(:)); % take the main angle of the domain
throws an error because there is no argument to the angle function.
p = pcolor(X_rot, Y_rot, h); shading interp
h is undefined.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour 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!



