![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189169/image.png)
Can I create a colorbar that is not associated to a figure?
3 views (last 30 days)
Show older comments
Samantha Clayton
on 11 Jun 2018
Answered: Image Analyst
on 11 Jun 2018
Can I create a colorbar that is not associated to a figure? I have created a series of heat maps that I want a colorbar with, but it is not possible to change any properties of the colorbar from a heatmap. Thus, I want to know if it is possible to create one just from my limits that is not attached to the heatmap so I can adjust it.
0 Comments
Accepted Answer
Image Analyst
on 11 Jun 2018
Samantha, try this:
rows = 512; % Whatever size you want.
columns = 50;
cmap = hsv(rows);
colorImage = ind2rgb([1:rows]', cmap);
colorImage = imresize(colorImage, [rows, columns], 'nearest');
imshow(colorImage);
axis on;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189169/image.png)
0 Comments
More Answers (0)
See Also
Categories
Find more on Colormaps 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!