Mirror x-axis of Image but not the x-axis of the plot over top of it?
5 次查看(过去 30 天)
显示 更早的评论
I have an image that I am plotting. The x-axis is reversed and I need to merely flip the image. I am trying to use set(gca,'xdir','reverse') to reverse the xaxis, but this reverses the x-axis for all plotting on top of the image after that. How do I only flip the x-axis of the image but leave the rest of the plots on top of the image the same? I shared a little of the code but it is hard to establish the necessary variables for any of the code to run. Anyone know how to flip the xaxis for the image but retain the xaxis for the points plotted over top of the image?
figure(1)
hold on
im = image('XData', [0 2500], 'YData', [0 800], 'CData', N_new(:,:,1), 'CDataMapping', 'scaled');
colormap(flipud(pink))
set(gca,'xdir','reverse')
AxesH = gca;
axis(AxesH, 'tight');
plot(x_a, y_a, 'b')
grid on
hold off
0 个评论
采纳的回答
OCDER
2017-10-4
Try flipping the data stored in im instead of the x/y axes direction.
im.CData = flipud(im.CData) %To flip image across horizontal axes
im.CData = fliplr(im.CData) %To flip image across vertical axes
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!