R/plotJACKLLZ.R

Defines functions plotJACKLLZ

Documented in plotJACKLLZ

plotJACKLLZ<-function(hjack, sta, proj=NULL, PLOT=1  )
{
###  there are 2 possible plots created, each with a different default size
###  if plot = {0,1,2}
#######  plot the output of HiJACK
#### This will not work: if(DEST==FALSE) { DEST=NULL }


    op <- par(no.readonly = TRUE)
    on.exit(par(op))

    
    ##  if(length(width)<2) { width = c(width[1], 0.5*width[1]) }
    ##  if(length(height)<2) { height = c(height[1], height[1]) }

    
    YEYE=hjack$Y
    XEYE=hjack$X
    ZEYE=hjack$Z
    
    L1 = as.vector( unlist( lapply(YEYE, "length") ) )
    Lw = which(L1>0)

    YEYEB = vector(mode="list")
    for(i in 1:length(Lw) )
    {
        YEYEB[[i]] = YEYE[[Lw[i]]]

    }
    names( YEYEB) = names(YEYE)[Lw]


    
################################

    L1 = as.vector( unlist( lapply(XEYE, "length") ) )
    Lw = which(L1>0)

    XEYEB = vector(mode="list")
    for(i in 1:length(Lw) )
    {
        XEYEB[[i]] = XEYE[[Lw[i]]]

    }
    names( XEYEB) = names(XEYE)[Lw]
################################
    L1 = as.vector( unlist( lapply(ZEYE, "length") ) )
    Lw = which(L1>0)

    ZEYEB = vector(mode="list")
    for(i in 1:length(Lw) )
    {
        ZEYEB[[i]] = ZEYE[[Lw[i]]]

    }
    names( ZEYEB) = names(ZEYE)[Lw]


    ##  boxplot.stats(x, coef = 1.5, do.conf = TRUE, do.out = TRUE)
    Blat = boxplot(YEYEB, plot=FALSE)
    
    Blon = boxplot(XEYEB, plot=FALSE)
    
    Bz = boxplot(ZEYEB, plot=FALSE)
    
    ##
    if(PLOT==1)
    {
        
        par(mfrow=c(3,1))

        
        bxp(Blat, varwidth=TRUE)
        title("Station Influence Lat")

        bxp(Blon, varwidth=TRUE)
        title("Station Influence Lon")

        bxp(Bz, varwidth=TRUE)
        title("Station Influence Z")
        
        
    }


    if(  PLOT==2)
    {


        par(mfrow=c(3,1))
        

        Gxy = GEOmap::GLOB.XY(  sta$lat   ,sta$lon , proj)
        plot(Gxy$x, Gxy$y, type='n', xlab="km", ylab="km", asp=1 )
        imageINFLUENCE(Blat, sta, proj)
        title("Station Influence Latitude")
        
        plot(Gxy$x, Gxy$y, type='n', xlab="km", ylab="km", asp=1 )
        imageINFLUENCE(Blon, sta, proj)
        title("Station Influence Longitude")
        
        plot(Gxy$x, Gxy$y, type='n', xlab="km", ylab="km", asp=1 )
        imageINFLUENCE(Bz, sta, proj)
        title("Station Influence Depth")


    }
    return(list( X=XEYEB, Y=YEYEB, Z=ZEYEB   ) )
}

Try the Rquake package in your browser

Any scripts or data that you put into this service are public.

Rquake documentation built on June 22, 2024, 11:54 a.m.