Figuring out how to set custom RGB colors in fill function in R202b
49 views (last 30 days)
Show older comments
Hello all:
I am trying to specify an rgb color to use for the fill function in R2020b using what is common MatLab synax:
cmap = [0 0 .3333;
0 0 .6667;
0 0 1];
tt = 1:.5:10;
lb1 = tt;
ub1 = 2.*tt;
x2 = [tt,fliplr(tt)];
inBetween = [lb1,fliplr(ub1)];
h = fill(x2, inBetween,'Color',cmap(1,:),'LineStyle','none');
set(h,'facealpha',.4)
but when I run this code I get the following error:
Error using fill
Not enough input arguments.
Error in tplots (line 192)
h = fill(x2, inBetween,'Color',cmap(1,:),'LineStyle','none');
So my question is is there some way to set custom RGB color for the fill function?
2 Comments
Image Analyst
on 28 Sep 2021
I'd need to run your code, which I can't at the moment because you forgot to attach tt, lb1, and ub1. Once you attach those I can try to run your code and fix it.
Answers (1)
Walter Roberson
on 28 Sep 2021
cmap = [0 0 .3333;
0 0 .6667;
0 0 1];
tt = 1:.5:10;
lb1 = tt;
ub1 = 2.*tt;
x2 = [tt,fliplr(tt)];
inBetween = [lb1,fliplr(ub1)];
h = fill(x2, inBetween, cmap(1,:),'LineStyle','none');
set(h,'facealpha',.4)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!