Colorbar with three colors

18 次查看(过去 30 天)
Yunhui He
Yunhui He 2017-10-3
回答: KSSV 2017-10-3
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
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Purple 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by