Mirror x-axis of Image but not the x-axis of the plot over top of it?

조회 수: 19 (최근 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

채택된 답변

OCDER
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개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by