Avoid turning plot when on a figure
1 次查看(过去 30 天)
显示 更早的评论
Hello!
I need to plot x and y coordinates over a figure representing a map, which will be displayed at a viewport on the rightop of the figure.
However, when I use the code below, it works, but y coordinates of the points are flipped. Using only the first three lines of the code places the figure properly; using the code without the image function places the points in the correct position. When I run the whole code, y-axis flips and y-coordinates are plotted flipped. I tried set(gca,'Ydir','reverse'), but it did not work.
Any help?
Thanks.
ha2=axes('position',[0.75, 0.55, .22,.42,]); % position of the viewport
image(mapabase,'XData',[-49.7 -48.7],'YData',[1.12 1.67]) %image workin as a map
hold on
for k=1:1:qtde_psgns
plot(navios_cel{k}(:,4),navios_cel{k}(:,3),'.','markers',5); %coordinates of several surveys
end
grid on
hold off
xlim ([-49.7 -48.7])
ylim ([1.12 1.67])
0 个评论
采纳的回答
Adam Danz
2019-8-20
"I tried set(gca,'Ydir','reverse'), but it did not work."
That's because for image() plots the ydir is already set to 'reverse'. You want to set it to 'normal'.
ha2.YDir = 'normal'
% or
set(ha2, 'YDir', 'normal')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!