Mirror x-axis of Image but not the x-axis of the plot over top of it?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Andrew Poissant
le 4 Oct 2017
Commenté : Andrew Poissant
le 4 Oct 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 commentaires
Réponse acceptée
OCDER
le 4 Oct 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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!