[R] zero line

PIKAL Petr petr.pikal at precheza.cz
Mon Mar 18 10:29:07 CET 2013


Hi

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of bgnumis
> Sent: Sunday, March 17, 2013 4:12 PM
> To: r-help at r-project.org
> Subject: [R] zero line
> 
> Hi all,
> 
> I´m plotting cf (with two axis) and addind a shaded color up and down
> on the 0 line x axis (tfr1 is the time). The thing is that when I plot
> this graph adds a line up on the "first" plot.
> 
> I hope you can understand what I mean.

Not much

> plot(cf[,1],type="l",col="black", xlab="Time", ylab="Correlation", axes=F)
Error in plot(cf[, 1], type = "l", col = "black", xlab = "Time", ylab = "Correlation",  : 
  object 'cf' not found

No object cf here.
It would be good if you make your code reproducible by putting a result of

dput(cf) 

and make available other objects used for plotting. Or you can try to present some fake data illustrating your points.

> 
> How should I erase this sencond line, it is suposed they have the same
> data? Why zero line doesn´t complete the shaded area?
> 
> plot(cf[,1],type="l",col="black", xlab="Time", ylab="Correlation",
> axes=F)
> grid()
> 
> cord.x <- c(0,1:length(cf[,1]), length(cf[,1])) cord.y <- c(0,cf[,1],0)
> polygon(cord.x,cord.y,col='skyblue')
> par(new=T)

>From below code you have some object named T. Hence your above code probably do not do what you expect as your T is put in par not reserved word TRUE.

Regards
Petr

> variable<-matrix(0,length(cf[,1]),1)
> plot(tfr1[(T+Tcor):(nrow(tfr1)),1],variable,type="l",ylab="",col="black
> ",xlab="")
> mtext("Correlation",side=4,line=2,col=4)
> 
> title("Dinamic Correlation",font=4)
> 
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list