How to plot kriging analysis when packages presents conflicts and the option :: doesnt work?

I did a plot with set packages (geoR", "oceanmap","raster"); however, it was possible to build the figure below (the current figure is a print screen because it has a higher size than permitted, sorry by this); It is important to clarify that this figure was built it had not edited by other programs. figure .

The current functions of these packages build figures unmatched with all parts disordered.

This is my code

require(oceanmap);require(geoR);require(raster);data(cmap)
set.seed(1000)

Y <- data.frame(Lon=runif(65,-92.43,-86.29), Lat=runif(65,20.73,23.75), 
               Data=runif(65,0.5,4.1));Y

cgeo <- as.geodata(Y)
plot(cgeo)

varigr <- variog(cgeo, direction="omnidirectional")
plot(varigr, pch=19,col="red")

gnt <- likfit(cgeo,ini=c(1.5,1.5),fix.nug=FALSE,cov.model="gneiting");gnt
borders <-data.frame(
  Lon=c(-92.21361, -91.17074, -88.60174, -86.57961, -86.14720, -86.18536, -86.22351, -86.35069, -89.37753, -92.49340,-92.46796, -92.45524), 
  Lat=c(20.76919, 20.78056, 20.84879, 20.87722, 20.87722, 22.27024, 23.10037, 23.80540, 23.83383, 23.81678, 22.38964, 20.82605))


grids <- expand.grid(lon=seq(-93, -85.5, length=600), lat=seq(20.5, 24.5, length=600))

krig<-krige.conv(cgeo,loc=grids, krige=krige.control(cov.pars = gnt$cov.pars,
                                                 cov.model = "gneiting", 
                                         type.krige = "ok", nugget = gnt$nugget),borders=borders)

image(krig, borders=NULL)
contour(krig, add=TRUE, borders=NULL, col="white", cex=1)

text(Y$Lon, Y$Lat, rownames(Y), cex=0.8)
plotmap(lon=c(-92.5, -86), lat=c(20.5, 24.5), add= TRUE, 
    col.land= "forestgreen",cex.lab = 0.9, grid.res = 1.5, border="black", bwd=1, cex=0.8)

compassRose(-92, 24, rot=0, cex=0.6)
scalebar(100, xy= c(-89.2,20.89), type = "bar", divs = 4, cex = 0.8, below = "Kilómetros", adj=c(0.5, -1))

legend.krige(x.leg = c(-85.79,-85.69), y.leg =c(20.7, 24.2), col=cmap$jet, cex=1,vertical=TRUE, 
         val= krig$predict,scale.,offset.leg=0.9, family="Times New Roman")
par(fn)

The problems are:

  1. The current figure it is impossible to plot, and there are problems with packages when they are called with ::
  2. Sometimes the plot isn't built or the figure obtained is unconfigured inside the limits established with the kirging area close to the left-side and the map in director to the right.
  3. The most common problem is that the kringing area disappear when plotmap function is called.
  4. Stations position unmatch with the kriging area.

I appreciate the help with this question.

Upvotes: 0

Views: 159

Answers (0)

Related Questions