It is known (several discussions on internet) that axis() cannot be used after fields:::image.plot() (axis() shows nothing).

However, if points(1.5, 1.5, type="p") is inserted before the axis() finctions, it works.

I have investigated what points(1.5, 1.5, type="p") is doing to allow axis to work and I don't find a solution. par() options are identical (p1 and p2 are identical).

Has someone a solution ?

Thanks

Marc

library(fields)
p0 <- par(no.readonly=TRUE)
image.plot(D, col=rev(heat.colors(128)),bty="n", xlab="Lines",
ylab="Columns", cex.lab = 0.5, zlim=c(min(D, na.rm=TRUE),max(D, na.rm=TRUE)),
           las=1, axes=FALSE)
p1 <- par(no.readonly=TRUE)

# if you remove this points() function, axis will show nothing.

points(1.5, 1.5, type="p")
p2 <- par(no.readonly=TRUE)

##########
axis(1, at=seq(from=0, to=1, length=nrow(D)), labels=0:2, cex.axis=0.5)
axis(2, at=seq(from=0, to=1, length=ncol(D)), labels=0:3, las=1, cex.axis=0.5)

identical(p1, p2)

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to