[R] Odp: Superimposing Multiple Vectors Plots in One Figure

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Fri, 27 Jun 2008 12:09:27 +0200

Hi

you mix base and lattice graphics.

r-help-bounces_at_r-project.org napsal dne 27.06.2008 08:25:55:

> Hi,
>
> I have 3 vectors which I want to plot as in one plot.
> I was wondering why this code of mine only show the last vector:
>
> __BEGIN__
> library(lattice)
>
> out_fname <- paste("MyPlot.png",sep="")

why not
out_fname <- "MyPlot.png"
result is same

>
> trellis.device("png", color=TRUE)

here you are setting png device for lattice output

> png(out_fname)

here you set png device for base graphics output

> plot(vect1,type="l",col="red",xlab="Nof Genes", ylab="RMSD")
> plot(vect2,type="l",col="blue")
> plot(vect3,type="l",col="green") # final graph only showed this one.

You make 3 plots to this device, each time overwriting previous plot.

> dev.off()

Here you end png device for base graphics.

If you insist on not reading let say introduction to R, which is quite good for any starting point, then at least look at

?plot
?lines
?points
?par - especially mfrow, mfcol
?layout

and try to test examples which are located on help pages and go through some links on those pages

If you want to use Lattice then you shall go through ?xyplot

and maybe some others and again test provided examples.

Regards
Petr

>
> __END__
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> ______________________________________________
> 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.



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. Received on Fri 27 Jun 2008 - 10:48:20 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 27 Jun 2008 - 16:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive