Using custom colour with contourf

8 ビュー (過去 30 日間)
RPatel
RPatel 2017 年 8 月 21 日
回答済み: RPatel 2017 年 8 月 21 日
Hello,
I would like to use a custom colourmap 'mycmap' with contourf, how can I do this? I looked at previously asked questions and replies, but couldn't find anything which would help.
mycmap is a [64*3] matrix with values between 0 and 1. I tried [C,h]=contourf(dist_range,vel_range,capacity,14,'LineColor',mycmap'); and other ways, but couldn't succeed.

採用された回答

RPatel
RPatel 2017 年 8 月 21 日
I found the answer. It was simply colormap(mycmap)
Thanks :)

その他の回答 (1 件)

KSSV
KSSV 2017 年 8 月 21 日
See the below example:
[X,Y,Z] = peaks(100) ;
surf(X,Y,Z)
view(2)
shading interp
% C = colormap ;
C = rand(64,3) ;
colormap(C)
I am using a random colormap in the above....it changes every time....You need to define your own C with your required colors...to get what you want...

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by