Rotate the colormap image: Axis labels missing after rotation!

I have a colormap image as shown here.
I want to rotate it through 45 degrees. I used imrotate to perform this as follows:
ImageRot=imrotate(Image,45);
imshow(ImageRot,'colormap',jet)
set(gca,'Clim',[0,25])
After doing this, I am getting the image rotated but unfortunately without axis, labels and title... im just getting the image (following image).
How can I insert the axis labels and all or how to perform rotation keeping the axis labels and title?

2 Kommentare

What is the point of the set() function? What if you just don't call that? At what point does the colorbar vanish?
aneps
aneps am 14 Dez. 2014
Bearbeitet: aneps am 14 Dez. 2014
set() is just to adjust the intensity scale of the colormap. I can remove it and change the intensity manually. But that doesn't solve the issue of missing axes labels etc...The colorbar and axes labels vanish when I use 'imshow'

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 14 Dez. 2014

1 Stimme

After the call to imshow(), call colorbar().

9 Kommentare

It gives the colorbar but NOT the X-Y axes and its labels!
Not sure why the colorbar axes are off by default for you. Or is it the image axes you wanted to see? Maybe try
axis on
Yes.. Now it worked.. but, the X and Y axes range from 0 to 145!... I think, it should be rescaled. How can I scale the X and Y axes? I tried with gcf function:
hAxes = findobj(gcf, 'type' ,'xaxis','type','yaxis')
But now confusing how to rescale image axis from 0 to 40 as in the first image. (I know x and y axes should be multiplied with a factor 145/40. But, how to apply on the figure imshow?)
Are you talking about axis/tick marks on the color bar, or on the axes that is displaying the image? For imshow(), there are xdata and ydata parameters that you can pass in if you want the axes to show numbers in some calibrated coordinate system.
aneps
aneps am 15 Dez. 2014
Bearbeitet: aneps am 15 Dez. 2014
I am talking about axes (X and Y) displayed in the first image (Not the marks on the colorbar). I want to have the X and Y axes (0 to 40 mm) marked in the imshow (second image after 45 degree rotation).
aneps
aneps am 15 Dez. 2014
Bearbeitet: aneps am 15 Dez. 2014
I have tried the following, improved a little bit.
imshow(ImageRot,'XData',[0 40],'YData',[0 40]);
Unfortunately, the axes appearing weird (the lower left corner is not 0,0)! :(
That's not weird - that's the way images work. The top line is line #1. What is you try to reverse the Y
imshow(ImageRot, 'XData', [0 40], 'YData', [40 0]);
or else
set(gca, 'ydir', 'reverse');
I tried, it is not working!.. giving the same thing again :(
Thanks... I made it finally using 'flipud':
imshow(flipud(ImageRot),'XData',[0 40],'YData',[0 40])
set(gca, 'ydir', 'normal');

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

am 14 Dez. 2014

Kommentiert:

am 15 Dez. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by