Mirror x-axis of Image but not the x-axis of the plot over top of it?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Andrew Poissant
am 4 Okt. 2017
Kommentiert: Andrew Poissant
am 4 Okt. 2017
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 Kommentare
Akzeptierte Antwort
OCDER
am 4 Okt. 2017
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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!