Adding a colorbar to a figure
이전 댓글 표시
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개)
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!