[R] Representing a statistic as a colour on a 2d plot
mister_bluesman at hotmail.com
Thu May 10 13:46:52 CEST 2007
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?
Jim Lemon-2 wrote:
> mister_bluesman wrote:
>> Ive been getting the color.scale function to work. However, I really need
>> 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
>> file were 0.6, 0.7, 0.8, 0.9 and 1.0. Using color.scale scales them so
>> they differ, but only relative to each other, rather than taking the
>> 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.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> 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