
colorbar for specified color
    1 回表示 (過去 30 日間)
  
       古いコメントを表示
    
採用された回答
  jonas
      
 2018 年 9 月 28 日
        
      編集済み: jonas
      
 2018 年 9 月 28 日
  
      Based on the data and code given below in the comments, you can build a custom colorbar with textboxes. The result is quite nice!
The below code shows the steps involved, however it cannot be executed without adding it to the code which is provided by OP in the comments.
p=cbp.Position;
w=p(3)/numel(sg)
cmap=colormap(jet(length(sg)))
str=sprintfc('\n Class %g',1:numel(sg))
for i=1:numel(sg)
annotation('textbox',[p(1)+w*(i-1) p(2) w*0.95 p(4)],'backgroundcolor',cmap(i,:),'string',str{i})
end

8 件のコメント
  jonas
      
 2018 年 9 月 28 日
				Happy to help! Yes, I was going to do that but wanted to wait until you were satisfied :)
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





