How to rotate domain, but the lon and lat are on the contour (not on the axis)
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
eko supriyadi
le 28 Juin 2025
Commenté : Torsten
le 29 Juin 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 commentaires
Dyuman Joshi
le 28 Juin 2025
Déplacé(e) : Dyuman Joshi
le 29 Juin 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
le 28 Juin 2025
Déplacé(e) : Dyuman Joshi
le 29 Juin 2025
Réponse acceptée
Walter Roberson
le 28 Juin 2025
Modifié(e) : Walter Roberson
le 28 Juin 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 commentaires
Torsten
le 29 Juin 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



