Adding a colorbar to a figure
15 views (last 30 days)
Show older comments
Yow-Ren Chang
on 16 Sep 2017
Commented: Yow-Ren Chang
on 18 Sep 2017
Hi, I am trying to display a colorbar in a figure. So some background on what I am doing: I am tracking objects (from images) in 3D and in time. I wanted to just visualize the tracking so I am plotting the x and y position of an object as a circle and then color-code the circle to represent z. The way I color code is I check at what z position an object is and then assign it a color (see below).
The code is something like this:
figure;
% display the original image
imshow(image)
hold on
% loop through the data and check z position to color-code
for j = 1:n
viscircles(data(j,1:2,radius(j),'color',colors(round(data(j,3)),:));
end
where the columns in 'data' are the x, y, z positions and 'colors' is a colormap that I defined for certain z values. So I get an image something like the one attached.
So I was wondering if anyone could point me in a direction for how to add a colorbar in the figure to provide information about the z position? Any help would be greatly appreciated, thanks!

0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Blue 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!