How to rotate domain, but the lon and lat are on the contour (not on the axis)
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
eko supriyadi
el 28 de Jun. de 2025
Comentada: Torsten
el 29 de Jun. de 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 comentarios
Dyuman Joshi
el 28 de Jun. de 2025
Movida: Dyuman Joshi
el 29 de Jun. de 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
el 28 de Jun. de 2025
Movida: Dyuman Joshi
el 29 de Jun. de 2025
Respuesta aceptada
Walter Roberson
el 28 de Jun. de 2025
Editada: Walter Roberson
el 28 de Jun. de 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 comentarios
eko supriyadi
el 29 de Jun. de 2025
Editada: eko supriyadi
el 29 de Jun. de 2025
Torsten
el 29 de Jun. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



