[R] col allocation is not right

jim holtman jholtman at gmail.com
Thu May 20 15:02:10 CEST 2010


Look at the RColorBrewer package to understand how you can create the
colors you want.  Also do "?colorRampPalette"

On Wed, May 19, 2010 at 4:24 PM, Changbin Du <changbind at gmail.com> wrote:
> Thanks, Phil!
>
> Does that mean only eight colors can be used in R plot?
> THe following codes works for me, but, if I use the number, it does not
> work.
>
> plot(svm.auc, col=2, main="ROC curves comparing classification performance\n
> of six machine learning models")
> legend(0.5, 0.6, c(ns, nb, nr, nt, nl,ne), c(2,3,4,5,6,"black")) # Draw a
> legend.
>
> plot(bo.auc, col=3, add=T) # add=TRUE draws on the existing chart
> plot(rf.auc, col=4, add=T)
> plot(tree.auc, col=5, add=T)
> plot(nn.auc, col=6, add=T)
> plot(en.auc, col="black",lty=4,lwd=3, add=T)
>
>
>
> On Wed, May 19, 2010 at 11:30 AM, Phil Spector <spector at stat.berkeley.edu>wrote:
>
>> Changbin -
>>   Please take a look at the help file for the function
>> "palette", which is how R maps col= numbers to colors.
>> Also look at the default output of that function:
>>
>>  palette()
>>>
>> [1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta" "yellow"
>> [8] "gray"
>>
>> You might get better results by specifying the colors that you
>> want directly.
>>
>>                                        - Phil Spector
>>                                         Statistical Computing Facility
>>                                         Department of Statistics
>>                                         UC Berkeley
>>                                         spector at stat.berkeley.edu
>>
>>
>>
>> On Wed, 19 May 2010, Changbin Du wrote:
>>
>>  plot(svm.auc, col=2, main="ROC curves comparing classification
>>> performance\n
>>> of six machine learning models")
>>> legend(0.5, 0.6, c(ns, nb, nr, nt, nl,ne), 2:6, 9) # Draw a legend.
>>>
>>> plot(bo.auc, col=3, add=T) # add=TRUE draws on the existing chart
>>> plot(rf.auc, col=4, add=T)
>>> plot(tree.auc, col=5, add=T)
>>> plot(nn.auc, col=6, add=T)
>>> plot(en.auc, col=9,lty="dotted",lwd=3, add=T)
>>>
>>> Hi, Dear community,
>>>
>>> I am use the above codes to draw plot, but find that col =9 is not used by
>>> the R.  Instead, it use the col=2 when plot en.auc. WHy this happens and
>>> how
>>> to check the col allocation in R?
>>>
>>> Thanks!
>>>
>>>
>>> --
>>> Sincerely,
>>> Changbin
>>> --
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org 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.
>>>
>>>
>
>
> --
> Sincerely,
> Changbin
> --
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list