在contourf上使用自定义色彩映射

时间:2017-08-21 10:51:02

标签: matlab matlab-figure contourf

我创建了一个colourmap' mycmap'我想在Matlab中的每个contourf上使用它。这是怎么回事?

我试过了

[C,h]=contourf(Xrange,Y_range,capacity,14,'LineColor',mycmap');

但它不起作用。我的自定义色标看起来像:

mycmap =

0.9725    0.9725    0.9725
0.9442    0.9442    0.9442
0.9159    0.9159    0.9159
0.8876    0.8876    0.8876
0.8593    0.8593    0.8593
0.8310    0.8310    0.8310
0.8027    0.8027    0.8027
0.8002    0.8002    0.8002
0.7976    0.7976    0.7976
0.7950    0.7950    0.7950
0.7924    0.7924    0.7924
0.7204    0.7204    0.7204
0.6484    0.6484    0.6484
0.6484    0.6484    0.6484
0.6484    0.6484    0.6484
0.6329    0.6329    0.6329
0.6175    0.6175    0.6175
0.6021    0.6021    0.6021
0.5885    0.5885    0.5885
0.5750    0.5750    0.5750
0.5615    0.5615    0.5615
0.5480    0.5480    0.5480
0.5345    0.5345    0.5345
0.5210    0.5210    0.5210
0.5075    0.5075    0.5075
0.4940    0.4940    0.4940
0.4564    0.4564    0.4564
0.4188    0.4188    0.4188
0.4092    0.4092    0.4092
0.3995    0.3995    0.3995
0.3899    0.3899    0.3899
0.3802    0.3802    0.3802
0.3706    0.3706    0.3706
0.3609    0.3609    0.3609
0.3512    0.3512    0.3512
0.3416    0.3416    0.3416
0.3328    0.3328    0.3328
0.3239    0.3239    0.3239
0.3151    0.3151    0.3151
0.3063    0.3063    0.3063
0.2974    0.2974    0.2974
0.2886    0.2886    0.2886
0.2798    0.2798    0.2798
0.2771    0.2771    0.2771
0.2743    0.2743    0.2743
0.2716    0.2716    0.2716
0.2689    0.2689    0.2689
0.2661    0.2661    0.2661
0.2634    0.2634    0.2634
0.2607    0.2607    0.2607
0.2580    0.2580    0.2580
0.2552    0.2552    0.2552
0.2525    0.2525    0.2525
0.2498    0.2498    0.2498
0.2471    0.2471    0.2471
0.2196    0.2196    0.2196
0.1922    0.1922    0.1922
0.1647    0.1647    0.1647
0.1373    0.1373    0.1373
0.1098    0.1098    0.1098
0.0824    0.0824    0.0824
0.0549    0.0549    0.0549
0.0275    0.0275    0.0275
     0         0         0

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

您可以在绘图后调用颜色贴图 ...

[C,h]=contourf(Xrange,Y_range,capacity,14)
colormap(mycmap);