[R] How to plot curves with more than 8 colors

Vincent Deng bioflash at gmail.com
Tue Dec 27 11:31:19 CET 2005


Dear Uwe,

Sorry, I did not describe my question clearly. I created a matrix to
store color code using rgb function.

abc = rgb(6:36,0,0,maxColorValue = 255)

And after running codes like this

for (i in c(1:20))
{
   points(...,...,col=abc[i])
   lines(...,col=abc[i])
}

R still used 8 colors of abc color codes repeatedly to draw the diagram

Any helps?

Best Regards...

On 12/27/05, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
> Vincent Deng wrote:
> > Hi,
> >
> > I'm a new hand in R language. I have about 20 groups of data[x,y] and
> > want to plot them on a graph. To do this, I write a for-loop as
> > following: (some codes are omitted for simplicity)
> >
> > for (i in c(1:20))
> > {
> >   points(...,...,col=i)
> >   lines(...,col=i)
> > }
> >
> > The problem is "R only plot them with 8 colors repeatly". Could anyone
> > help me solve this problem? Or is there any package providing plot
> > function without color limit?
>
>
> After typing
>
>   ?colors
>
> I get a nice help page that points me to a lot of other functions that
> generate more than 8 colors. Maybe your installation of R is broken and
> you cannot see this help page? You certainly tried to get help on colors
> as well.
>
> There is no limit of the color number in the functions above, simply
> specify the color you want to get. The only color limit applies for the
> device and for most devices and rgb colors this is 256^3.
>
> Uwe Ligges
>
>
>
>
> > Best Regards...
> >
> > ______________________________________________
> > 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
>
>




More information about the R-help mailing list