Skip to content

Commit

Permalink
added useRaster = TRUE in image() for plotting maps
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmus committed Jul 1, 2024
1 parent af91225 commit c94498f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/diagnose.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ diagnose.station <- function(x,...,main='Data availability',

image(index(x),1:d[2],coredata(x),
main=main,xlab=xlab,ylab=ylab,
sub=sub,...)
sub=sub,useRaster = TRUE,...)
axis(4,at=1:d[2],labels=substr(loc(x),1,nletters),
cex.lab=0.5,col='grey')
par(xpd=FALSE)
Expand Down
10 changes: 5 additions & 5 deletions R/image.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ image.plot <- function (..., breaks=NULL, add = FALSE, nlevel = 64, horizontal =
par(plt = bigplot)
}
if (!info$poly.grid) {
image(..., add = add, col = col)
image(..., add = add, col = col,useRaster = TRUE)
} else {
poly.image(..., add = add, col = col, midpoint = midpoint,
border = border, lwd.poly = lwd, verbose=verbose)
Expand Down Expand Up @@ -119,19 +119,19 @@ image.plot <- function (..., breaks=NULL, add = FALSE, nlevel = 64, horizontal =
if (verbose) print("not horizontal")
if (is.null(breaks)) {
image(ix, iy, iz, xaxt = "n", yaxt = "n", xlab = "",
ylab = "", col = col)
ylab = "", col = col,useRaster = TRUE)
} else {
if (verbose) print("horizontal")
image(ix, iy, iz, xaxt = "n", yaxt = "n", xlab = "",
ylab = "", col = col, breaks = breaks)
ylab = "", col = col, breaks = breaks,useRaster = TRUE)
}
} else {
if (is.null(breaks)) {
image(iy, ix, t(iz), xaxt = "n", yaxt = "n", xlab = "",
ylab = "", col = col)
ylab = "", col = col,useRaster = TRUE)
} else {
image(iy, ix, t(iz), xaxt = "n", yaxt = "n", xlab = "",
ylab = "", col = col, breaks = breaks)
ylab = "", col = col, breaks = breaks,useRaster = TRUE)
}
}
do.call("axis", axis.args)
Expand Down
2 changes: 1 addition & 1 deletion R/lonlatprojection.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ lonlatprojection <- function(x,it=NULL,is=NULL,new=FALSE,projection="lonlat",
xaxt="n",yaxt="n") # AM 17.06.2015

if (sum(is.element(tolower(type),'fill'))>0)
image(lon,lat,x,xlab="",ylab="", add=TRUE,
image(lon,lat,x,xlab="",ylab="", add=TRUE,useRaster = TRUE,
col=colbar$col,breaks=colbar$breaks)

if (geography) {
Expand Down
10 changes: 5 additions & 5 deletions R/vis.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ vis.station <- function(x,...,new=FALSE,col=NULL,n=NULL,main=NULL,log.precip=TRU
if (plot) {
if (new) dev.new()
par(bty="n")
image(1:366,yrs,z,main=main,xlab='',ylab='year',col=col,sub=loc(x),...)
image(1:366,yrs,z,main=main,xlab='',ylab='year',col=col,sub=loc(x),useRaster = TRUE,...)
grid()
}
attr(z,'x') <- 1:366
Expand Down Expand Up @@ -283,25 +283,25 @@ vis.pca <- function(x,...,cex=1.5,new=TRUE,verbose=FALSE) {
points(lon,lat,cex=cex,col=col[a.T[4,]],pch=19)

par(mar=c(1,0,0,0),fig=c(0.1,0.3,0.665,0.695),new=TRUE,cex.axis=0.6)
image(cbind(1:nc,1:nc),col=col)
image(cbind(1:nc,1:nc),col=col,useRaster = TRUE)
nl <- pretty(scale0)
par(xaxt="s")
axis(1,at=seq(0,1,length=length(nl)),labels=nl)

par(mar=c(1,0,0,0),fig=c(0.1,0.3,0.32,0.35),new=TRUE,cex.axis=0.6,xaxt="n")
image(cbind(1:nc,1:nc),col=col)
image(cbind(1:nc,1:nc),col=col,useRaster = TRUE)
nl <- pretty(scale)
par(xaxt="s")
axis(1,at=seq(0,1,length=length(nl)),labels=nl)

par(mar=c(1,0,0,0),fig=c(0.6,0.8,0.665,0.695),new=TRUE,cex.axis=0.6,xaxt="n")
image(cbind(1:nc,1:nc),col=col)
image(cbind(1:nc,1:nc),col=col,useRaster = TRUE)
nl <- pretty(scale)
par(xaxt="s")
axis(1,at=seq(0,1,length=length(nl)),labels=nl)

par(mar=c(1,0,0,0),fig=c(0.6,0.8,0.32,0.35),new=TRUE,cex.axis=0.6,xaxt="n")
image(cbind(1:nc,1:nc),col=col)
image(cbind(1:nc,1:nc),col=col,useRaster = TRUE)
nl <- pretty(scale)
par(xaxt="s")
axis(1,at=seq(0,1,length=length(nl)),labels=nl)
Expand Down

0 comments on commit c94498f

Please sign in to comment.