[R] Plotting only masked part of data
Barry Rowlingson
B.Rowlingson at lancaster.ac.uk
Tue Jan 25 15:16:15 CET 2005
> is quite close - however I want to plot with lines, i.e. type="l", and
> then I get solid lines connecting the endpoint of one "active" region
> to the start of the next active region, I would prefer to get rid of
> those.
> Is there a simple general solution to my problem?
Plot will draw disconnected lines if there are NA values in the vector
of X or Y values, so if you do:
> x <- seq(0,4*pi,by=0.1)
> y <- sin(x)
> x[abs(y)>=0.5]=NA
> y[abs(y)>=0.5]=NA
> plot(x,y,type='l')
You may get what you want.
Baz
More information about the R-help
mailing list