how to save the picture with par(mfrow = c(1, 3), pty='s') setti ngs?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to save the picture with par(mfrow = c(1, 3), pty='s') setti ngs?

Glazko, Galina
Dear list,

 

I am trying to place 3 density functions in one Figure, 1 row by 3 columns:

 -------------------------------------------------------

op <- par(mfrow =  c(1, 3),pty='s')

pdf(file="Fig_den.pdf")

barplot2(tab.in,plot.grid=TRUE,xlab="number of HGT_in",ylab="density")

lines(dneg,col="red",lwd=2)

barplot2(tab.out,plot.grid=TRUE,xlab="number of HGT_out",ylab="density")

lines(dnegout,col="red",lwd=2)

barplot2(vt,plot.grid=TRUE,xlab="number of HT POGs",ylab="density")

lines(dnegpog,col="red",lwd=2)

dev.off()

par(op)

-------------------------------------------------------

Somehow in file Fig_den.pdf these figures are on the separate pages.

However, I get exactly what I need in the console window.

Could someone please explain me what I am doing wrong when saving Figure in
pdf?

 

Thank you!

Galina

 



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: how to save the picture with par(mfrow = c(1, 3), pty='s') setti ngs?

Peter Dalgaard
"Glazko, Galina" <[hidden email]> writes:

> Dear list,
>
>  
>
> I am trying to place 3 density functions in one Figure, 1 row by 3 columns:
>
>  -------------------------------------------------------
>
> op <- par(mfrow =  c(1, 3),pty='s')
>
> pdf(file="Fig_den.pdf")
....
> -------------------------------------------------------
>
> Somehow in file Fig_den.pdf these figures are on the separate pages.
>
> However, I get exactly what I need in the console window.
>
> Could someone please explain me what I am doing wrong when saving Figure in
> pdf?

You have par() before pdf(). Try it the other way around.

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html