[R] Ploting graphics using X tints from a color
Romain Francois
francoisromain at free.fr
Tue Dec 13 21:56:14 CET 2005
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 |
+---------------------------------------------------------------+
More information about the R-help
mailing list