[R] Trying to make plot of several time series in same graph

Paul Johnson pauljohn at ukans.edu
Wed Aug 9 21:59:47 CEST 2000


Dear Friends in R:

On RedHat linux, R-1.1, I've gotten far enough to create the graph that
shows on the screen with 3 lines, but I have some trouble. Here is the
way I created the three "overlaid" graphs:


data<-read.table("DataCulture0",header=T,as.is = TRUE)
attach(data)
tmp1<-plot(acquaint~T,type='l', ylim=c(0,1),ylab="average
proportion",xlab="PERIOD",xlim=c(1,6000),lty=1,pch=1,main="")
par("new"=TRUE)
tmp2<-plot(harmony~T,type='l', ylim=c(0,1),ylab="average
proportion",xlab="PERIOD",xlim=c(1,6000),lty=2,pch=1,main="")
par("new"=TRUE)
tmp3<-plot(identical~T,type='l', ylim=c(0,1),ylab="average
proportion",xlab="PERIOD",xlim=c(1,6000),lty=3,pch=1,main="")

Problems.
1. I want to label each line that is plotted on the graph.  Is there a
non interactive way to do it?  My coauthor uses S+ and he used  a
sequence of commands like this:
identify.xyplot(tmp1,labels=acq,n=1,adj=0)
But I don't think it is exactly what I want.

2. When I run the code above, the screen shows 3 lines with different
line styles.  IF I start over again with 
> postscript("../output.ps")
and then run the commands again, and then
> dev.off()
null device
          1 
In the ps file that is saved, all of the lines look the same.

I used the Gimp to take a "screenshot" of the figure as it looks in R:

http://lark.cc.ukans.edu/~pauljohn/exampleRGraph.gif

And the postscript output looks like this:

http://lark.cc.ukans.edu/~pauljohn/exampleRGraph.ps

Any help in saving graphs would be appreciated.  I feel totally
clueless, and I've been looking pretty hard in the V&R and R-intro.

3. In light of difficulty with line styles, I experimented with
character options with type='o' and various pch=x. Those pictures looked
terrible because the symbols were all too dense.  I guess I need
something to print every 100th point there? 

-- 
Paul E. Johnson                       email: pauljohn at ukans.edu
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list