[R] Representing a statistic as a colour on a 2d plot
mister_bluesman
mister_bluesman at hotmail.com
Thu May 10 13:46:52 CEST 2007
Hi Jim.
Thanks for all your help. But would this ensure that, say, the color for the
value 0.1 would ALWAYS be the SAME and ALWAYS be DIFFERENT from that of
other values, regardless of the size of the vector?
CHEERS
Jim Lemon-2 wrote:
>
> mister_bluesman wrote:
>> Ive been getting the color.scale function to work. However, I really need
>> to
>> know is that if i have values: 0.1 0.2, 0.3, 0.4, 0.5, for example, how I
>> can plot these using colours that would be different if the contents of
>> the
>> file were 0.6, 0.7, 0.8, 0.9 and 1.0. Using color.scale scales them so
>> that
>> they differ, but only relative to each other, rather than taking the
>> actual
>> value and converting them to some unique colour/colour intensity.
>>
>> Many thanks
>>
> There are a couple of ways to go about this. If you know that there are
> say ten possible values, you can use the color.gradient function to
> assign ten colors across a particular range. Then you would have to map
> the colors to the numbers (I would do something like creating a two
> element list of the sorted unique numbers and the colors. Then assign
> the color vector for the plot from this list.) Note that both
> color.scale and color.gradient are aimed at producing colors that
> visually represent some range like cold(blue) to hot(red). If you just
> want to get 20 easily discriminated colors and assign them to values,
> you might be better off with ColorBrewer.
>
> Jim
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Representing-a-statistic-as-a-colour-on-a-2d-plot-tf3703885.html#a10411818
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list