[R] hcl()
Robin Hankin
r.hankin at noc.soton.ac.uk
Fri Jun 24 12:32:49 CEST 2005
Professor Ripley
thanks for this.
>>
>> plot(1:50,pch=16,col=hcl(h=240, c=50, l=1:50))
>>
>> I get mostly blue, but also some red, dots. Note that h=240
>> throughout. If 240 is blue,
>> how come there's a red dot there? Or is it just my monitor?
>
>> hcl(h=240, c=50, l=1:50, fixup=F)
> [1] NA NA NA NA NA NA NA
> [8] NA NA NA NA NA NA NA
> [15] NA NA NA NA NA NA NA
> [22] NA NA NA NA NA NA NA
> [29] NA NA NA NA NA NA NA
> [36] NA NA NA "#08628E" "#126490" "#196693"
> "#1F6995"
> [43] "#246B97" "#286E9A" "#2D709C" "#31729F" "#3575A1" "#3877A4"
> "#3C7AA6"
> [50] "#3F7CA9"
>
> You have mainly used invalid values: you cannot have high chroma and
> low luminance (and there are warnings to that effect on the help
> page).
>
> Not sure the chosen mapping of out-of-gamut specs onto the sRGB gamut
> is particularly helpful, though.
>
Yes, this is what I was missing: with fixup taking its default value
of TRUE, out-of-range combinations are silently mapped to real RGB
values, [although the description of argument fixup in the
manpage conveys this information to me only now that I have
your example above to look at].
If I understand your comment, my odd-looking colours are a result of
this mapping.
So, how best to determine the maximum chroma for a given luminance and
hue?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
More information about the R-help
mailing list