Hi all , I have following script to plot some data. plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , las=2) axis (1, at = seq(0,1100,50), las =2) axis (2, at = seq(0,25,1), las =2) lines( c(1,304),c(0,0),col='grey', lwd=3 ) lines( c(1,238),c(1,1),col='grey', lwd=3 ) segments(86, 0 ,270,col = "green", pch=23, cex="9", lty="solid", lwd=14,lend=2) segments(74,1 ,238,col = "green", pch=23, cex="9", lty="solid", lwd=14,lend=2) When I source("script.R"), I got the image on interface but I do not want to use screenshot option to save the image? How can save the output to .pdf or .jpg format? Thanks in advance Thank you Khushwant [[alternative HTML version deleted]]
On 01/09/2010 8:56 AM, khush ........ wrote:> Hi all , > > I have following script to plot some data. > > plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , > las=2) > axis (1, at = seq(0,1100,50), las =2) > axis (2, at = seq(0,25,1), las =2) > > lines( c(1,304),c(0,0),col='grey', lwd=3 ) > lines( c(1,238),c(1,1),col='grey', lwd=3 ) > > segments(86, 0 ,270,col = "green", pch=23, cex="9", lty="solid", > lwd=14,lend=2) > segments(74,1 ,238,col = "green", pch=23, cex="9", lty="solid", > lwd=14,lend=2) > > When I source("script.R"), I got the image on interface but I do not want to > use screenshot option to save the image? How can save the output to .pdf or > .jpg format? >Open the appropriate device at the start of the script, and close it at the end. See ?pdf and ?jpeg for the details of how to open; use dev.off() to close. Duncan Murdoch> Thanks in advance > > Thank you > Khushwant > > [[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. >
On Wed, Sep 1, 2010 at 7:56 AM, khush ........ <bioinfo.khush at gmail.com> wrote:> Hi all , > > I have following script to plot some data. > > plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , > las=2) > axis (1, at = seq(0,1100,50), las =2) > axis (2, at = seq(0,25,1), las =2) >> > When I source("script.R"), I got the image on interface but I do not want to > use screenshot option to save the image? How can save the output to .pdf or > .jpg format? > > Thank you > KhushwantHi! This is one of the things that is difficult for newcomers. I've written down a pretty thorough answer: http://pj.freefaculty.org/R/Rtips.html#5.2 pj -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
On Sat, 2010-09-04 at 13:57 -0500, Paul Johnson wrote: On Wed, Sep 1, 2010 at 7:56 AM, khush ........ <bioinfo.khush at gmail.com> wrote:> > Hi all , > > > > I have following script to plot some data. > > > > plot( c(1,1100), c(0,15), type='n', xlab='', ylab='', ylim=c(0.1,25) , > > las=2) > > axis (1, at = seq(0,1100,50), las =2) > > axis (2, at = seq(0,25,1), las =2) > >> > > When I source("script.R"), I got the image on interface but I do notwant to> > use screenshot option to save the image? How can save the output to.pdf or> > .jpg format? > > > > Thank you > > Khushwant > > Hi! This is one of the things that is difficult for newcomers. I've > written down a pretty thorough answer: > > http://pj.freefaculty.org/R/Rtips.html#5.2 > > > pj >Very nice text, indeed. As my 2 cents I strongly recommend to use for graphs the .png format, .jpg is primarily designed for photographs. Have a nice time Tomas