4.Plots with gaps.

Plotrix

Plots with a gap

http://stackoverflow.com/questions/19612348/break-x-axis-in-r

x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12)
y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72)
z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)

library(plotrix)


gap.plot(x,y, gap=c(2,7.5), gap.axis="x", pch=16,
         col="blue", ylim=range(c(y,z)),
         xtics=c(0:3,8:10), xticlab=c(0:3,8:10), type="l")

gap.plot(x,z, gap=c(2,7.5), gap.axis="x", pch=16,
         col="red", ylim=range(c(y,z)), type="l", add=TRUE); axis(2)


abline(v=seq(1.99,2.09,.001), col="white" ,lty=1 )  # hiding vertical lines
axis.break(1,2,style="slash")  
axis.break(3,2,style="slash") # plotting slashes for breakpoints

#http://stackoverflow.com/questions/19719251/finding-date-gaps-in-r
#how to find gaps, to do: 
# - how to put them in a gap= parameter.
# - select only large significant gaps

DOY <- c(1,2,5,6,7,10,15,16,17)

#looking for missing values:

rDOY <- range(DOY); 
rnDOY <- seq(rDOY[1],rDOY[2]) 
rnDOY[!rnDOY %in% DOY]
[1]  3  4  8  9 11 12 13 14


#looknig ranges: beginnings and ends

DOY[ diff(DOY)!=1]
# [1]  2  7 10
DOY[-1] [ diff(DOY)!=1]
# [1]  5 10 15

results matching ""

    No results matching ""