Re: [R] Exporting a Graph that has lines()

From: Peter Dalgaard <>
Date: Thu, 03 Jul 2008 22:54:34 +0200

R_Learner wrote:
> I'm trying to export a graph (any form is good). I'm trying to export one
> that uses plot() then lines(). however, it seems that the jpeg format and
> the pdf format only takes the first line plot, and doesn't even consider the
> additional plots. My code is the following:
> output_file<-paste(filez,".pdf",sep="")
> pdf(output_file)
> plot((x_data) ~ (y_data), main = filez)
> lines (x,z,col="red")
> The pdf only comes out with the graph of the plot, and not of the lines.
> Does anyone know how to export multiple graph items on one plot?
> Thanks!
That shouldn't be a problem, but the above is not reproducible without the data. Are you sure that you actually executed the (pasting it onto the command line is not enough).

   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
~~~~~~~~~~ - (              FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Jul 2008 - 20:57:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jul 2008 - 01:31:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive