Colorbar with three colors
18 次查看(过去 30 天)
显示 更早的评论
I am using surf plot the pictures. I want to see the colorbar at the right-hand side. But the transition of the color is not so obvious. I want to see from green to red, and there is another color in the middle. How can I do this?
Thanks!
1 个评论
Walter Roberson
2017-10-3
Are there only 3 colors in the plot, or is it that you only want three colors to appear in the colorbar ?
If you are already doing colormap() in order to activate a colormap of three colors, then colorbar() should adjust automatically.
采纳的回答
KSSV
2017-10-3
Z = peaks(100) ;
surf(Z)
shading interp
cmap = [1 0 0 ; 0 1 0 ; 0 0 1] ;
colorbar
colormap(cmap)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Purple 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!