How do I colour a filled-in area with a color value different from the standard 'r','g','b' etc... ?

1 回表示 (過去 30 日間)
Hi, I'm filling in the area between two curves using the fill command.
An extract of the code is here:
...
tt2=[tt;flipud(tt)];
curve1=quantile(NE1Wd,q1,2);
curve2=quantile(NE1Wd,q2,2);
inBetweenWd=[curve1;flipud(curve2)];
plot(tt,curve1,'m'); plot(tt,curve2,'m');
f1=fill(tt2,inBetweenWd,'m','FaceAlpha',0.4);
...
what I want to be able to do is use a color value, say [0.5 1 0] instead of the value 'm' in the code above.
I've tried specifying '...'Color',[0.5 1 0],...' but I get the error 'Error using fill Not enough input arguments.'
Can someone tell me where I'm going wrong?
Many thanks for any help.
Rebecca

採用された回答

Adam Danz
Adam Danz 2018 年 9 月 24 日
You don't need to specify the 'color' parameter.
f1=fill(tt2,inBetweenWd,[0.5 1 0],'FaceAlpha',0.4);
  1 件のコメント
Rebecca Ward
Rebecca Ward 2018 年 9 月 24 日
Fab, thank you - I thought I'd tried that but clearly not. So thanks for your help :)

サインインしてコメントする。

その他の回答 (1 件)

Bish Erbas
Bish Erbas 2018 年 9 月 24 日
Have you tried:
f1=fill(tt2,inBetweenWd,[0.5 1 0],'FaceAlpha',0.4);

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by