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

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 2014년 12월 14일
편집: aneps 2014년 12월 14일
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'

댓글을 달려면 로그인하십시오.

 채택된 답변

Image Analyst
Image Analyst 2014년 12월 14일

1 개 추천

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

댓글 수: 9

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 2014년 12월 15일
편집: aneps 2014년 12월 15일
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 2014년 12월 15일
편집: aneps 2014년 12월 15일
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');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Orange에 대해 자세히 알아보기

질문:

2014년 12월 14일

댓글:

2014년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by