Colorbar is to large in colormapeditor when using imshow
1 view (last 30 days)
Show older comments
Hi
While working with the Matlab Image Processing Toolbox with MatLab R2012a I recognized a rather strange bug.
When displaying an image using image as plotting function and then opening the color bar editor, everything looks fine, except that the color scaling is not fitting correctly. To avoid this effect I normally use imshow, so that I can give color scale borders. When I open the colormapeditor in this mode the colorbar is way longer than the window, and this is quite cumbersome especially when one wants to adjust the colorbar with the colorflags. Unfortunately I cannot document the bug with pictures, since I don't know how to upload images to mathworks.com.
Is there a possibility to shrink the colorbar in "imshow-mode", so that it fits into the window?
Please find below the samplecode hopefully visualizing the problem.
Samplecode
cameraman = imread('cameraman.tif')
% Plot image with colortable
% first use of image()
figure;
image(cameraman)
axis equal
axis tight
colormapeditor
% first use imshow() with colorscaling
figure;
imshow(cameraman,[])
colormap('jet')
colormapeditor
Any help is appreciated
Thanks
Dominic
0 Comments
Accepted Answer
Anand
on 8 May 2013
Dominic, I don't think this is a bug. The image command gives a 64x3 colormap, whereas the imshow command gives a 256x3 colormap. You can see this if you scroll to the last strip in the colorbar and hover the mouse over. It should say index 64 for the image command and 256 for the imshow command.
If you want the shorter colorbar with the imshow command, you need to just replace
colormap('jet')
with
colormap(jet(64))
Hope that helps.
0 Comments
More Answers (1)
See Also
Categories
Find more on Red in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!