[R] How to Plot Two Curves Into One Page

Gundala Viswanath
Tue, 01 Feb 2011 06:41:46 -0000

Dear Jorge,

Thanks for the reply. But what I mean is to
create plot on "top" of another in to one page.

So in the end there will be only one plot with two curves.

Actually what I am to plot is two ROC curves.

- G.V.

On Tue, Feb 1, 2011 at 3:37 PM, Jorge Ivan Velez
<jorgeivanvelez at gmail.com> wrote:
> Hi Gundala,
> Yes.
> One way of doing it would be writing
> par( mfrow = c(1, 2))
> before plotting your variables. Thus, the following should do it:
> par( mfrow = c(1, 2)) ? ? # see ?par and the argument mfrow for more
> information
> plot(foo,lwd=2,lty=3,col="red", main="");
> plot(bar,lwd=2,lty=3,col="blue");
> legend(0.6,0.6,c('Default','Probabilistic'),
col=c('red','blue'),lwd=3);
>
> A second option would be setting up a suitable layout. For this, please
take
> a look at ?layout.
> Best,
> Jorge
>
>
> On Tue, Feb 1, 2011 at 12:20 AM, Gundala Viswanath <> wrote:
>>
>> I have a R script that contain these lines for plotting:
>>
>> plot(foo,lwd=2,lty=3,col="red", main="");
>> plot(bar,lwd=2,lty=3,col="blue");
>> legend(0.6,0.6,c('Default','Probabilistic'),
col=c('red','blue'),lwd=3);
>>
>>
>> But it generate 1 file (Rplot.pdf) with two pages. Each page for 1
plot.
>> Is there a way I can put them together in to one page?
>>
>> - G.V.
>>
>> ______________________________________________
>> 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.
>
>