[R] Plotting questions (ROCR)

Tobias Sing tobias.sing at gmail.com
Fri May 8 16:18:58 CEST 2009


To have several performance curves on a single plot, use the
"add=TRUE" option, e.g. as follows:

plot(perf1)
plot(perf2, add=TRUE, col='red')

Please read the help to ?plot.performance. It also tells you how you
can adjust all graphical parameters for the individual curves.
This slide deck contains several examples that might help you:
http://rocr.bioinf.mpi-sb.mpg.de/ROCR_Talk_Tobias_Sing.ppt

HTH,
  Tobias


On Fri, May 8, 2009 at 3:28 PM, lehe <timlee126 at yahoo.com> wrote:
>
> Thanks!
> I am now also trying to plot several ROCs in the same figure using ROCR
> package. The following code:
>
> "pred1 <- prediction(yest1,ytest)
> perf1 <- performance( pred1, "tpr", "fpr" )
> plot( perf1 )
> pred2 <- prediction(yest2,ytest)
> perf2 <- performance( pred2, "tpr", "fpr" )
> lines( perf2 )"
>
> will result in error at "lines( perf2 )":
>
> "Error in as.double(y) :   cannot coerce type 'S4' to vector of type
> 'double'"
>
> Is there any way to solve it?
>
> Regards,
>
>
>
>
> Richard Cotton wrote:
>>
>>> 1. How to plot several lines in a figure? Suppose I have several sets of
>>> points (xi,yi), where xi and yi are equal-length vector. plot(x1,y1)
>> will
>>> give a line connecting these points. Another plot(x2,y2) will erase what
>>> plot before and plot the new line. Can I have these lines all drawn in
>> the
>>> same figure?
>>
>> #Draw your plot
>> plot(seq(0,1,length.out=20))
>>
>> #Add lines to the existing plot
>> lines(runif(20))
>>
>> #Add points to the existing plot
>> points(runif(20), col="red")
>>
>>> 2. How to open another figure window? Repeating plot will redraw in the
>> same
>>> window instead of opening another one.
>>
>> On Windows, windows() will open a new figure window; quartz() on Mac OSX
>> and x11() on Linux do the same.
>>
>> Regards,
>> Richie.
>>
>> Mathematical Sciences Unit
>> HSL
>>
>>
>>
>> ------------------------------------------------------------------------
>> ATTENTION:
>>
>> This message contains privileged and confidential inform...{{dropped:20}}
>>
>> ______________________________________________
>> 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.
>>
>>
>> -----
>> Regards,
>> Richie.
>>
>> Mathematical Sciences Unit
>> HSL
>>
>
> --
> View this message in context: http://www.nabble.com/Plotting-questions-tp23442445p23446000.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list