How to rotate domain, but the lon and lat are on the contour (not on the axis)
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
Dyuman Joshi
2025-6-28
移动:Dyuman Joshi
2025-6-29
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.
采纳的回答
Walter Roberson
2025-6-28
编辑:Walter Roberson
2025-6-28
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 个评论
Torsten
2025-6-29
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



