Re: [R] Ploting graphics using X tints from a color

From: Romain Francois <francoisromain_at_free.fr>
Date: Wed 14 Dec 2005 - 07:56:14 EST

Le 13.12.2005 21:40, Romain Francois a écrit :

> Le 13.12.2005 19:34, Sérgio Nunes a écrit :
>
>> Hi,
>>
>> I'm trying to draw a 2D plot using multiple tints of red. The
>> (simplified) setup is the following: || year | x | y ||
>>
>> My idea is that each year is plotted with a different tint of red.
>> Older year (lightest) -> Later year (darkest). I've managed to plot
>> this with different scales of grays simply by doing:

>>
>> palette(gray(length(years):0/length(years)))
>>
>> before the plot and for each year the color used is a different tint
>> of gray.
>>
>> So, is there any way to do this for any color?
>> Any tip or advice?
>>
>> With this, I hope to visualize patterns in my dataset more easily.
>>
>> Thanks in advance for any help.
>>
>> Best regards,
>> Sérgio Nunes
>>
>>
> Hi,
>
> You want to travel in the RGB space.
> See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=107
>
> plot(0, xlim=c(0,10), ylim=c(0,1))
> pal <- rgb(1, 0:10/10,0:10/10)
> rect(xleft=0:9, xright=1:10, ytop=1, ybottom=0, col=pal)
>
> Romain
>
Ooooooooops !

s <- seq(0,1, length=10)
pal <- rgb(1, s, s)

is better.
Sorry.

And more generally, see ?colorRampPalette.

f <- colorRampPalette(c("royalblue", "white")) pal <- f(10)

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---------------------------------------------------------------+
| Romain FRANCOIS - http://francoisromain.free.fr               |
| Doctorant INRIA Futurs / EDF                                  |
+---------------------------------------------------------------+

______________________________________________
R-help@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
Received on Wed Dec 14 09:24:59 2005

This archive was generated by hypermail 2.1.8 : Wed 14 Dec 2005 - 14:31:31 EST