[R] Setting x-axis of a plot on each loop
David Winsemius
dwinsemius at comcast.net
Wed Nov 13 18:01:25 CET 2013
On Nov 13, 2013, at 12:24 AM, Baro wrote:
> I have a block of code:
>
> window<-5
> start<-3
> n<-1
>
> seq1 <- seq(1:40)
> mat<-matrix(seq1,40)
>
>
> while(1+window<=length(mat[,1]))
> {
> kd<-matrix(as.integer(mat[n:(n+window-1),1]))
> Sys.sleep(0.2)
>
> plot(kd,col="blue",xlab="Rohdaten",ylab="values",xlim=c(start+n,start+n+window-1)
> )
>
> n<-n+1
> }
>
> I have this expectation, that on each loop two x-axis and y-axis are
> changed and see the values on the plot. but I cant see the value.What
> should I do to have values too?. If I am changing this my code to
>
> plot(kd,col="blue",xlab="Rohdaten",ylab="values")
>
> I can see the values but on the x-axis I have no the correct values
You "see nothing" (except perhaps in the first few plots where I suspect points are being plotted within the plot area) because by offdering only one unnamed numeric argument to plot you implicitly use 1:5 as your x value in all plots. You say you have qn expectation that the and y values are changing but you don't change the x-values in your code. You have not described what you are trying to do so giving further advice is not possible. I take that back; further advice: It's always a good idea to name your arguments.
>
> [[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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list