[R] Odd gridding pattern when plotting

Balko, Justin justin.balko at Vanderbilt.Edu
Fri Sep 30 17:42:39 CEST 2011

Hi, I'm no longer on the subscribing list, but was hoping to get my question posted.  Please inform if this is ok, although I am guessing you wont post with the image below.  If so, let me know and I will resend without the image.

I just upgraded my system and my version of R all at once.  Upon running old code for heatmaps etc, I suddenly notice that there is an odd grid pattern appearing in all of my plots.  An example is below:

#example from ?image

require(grDevices) # for colours
x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32))
image(z, axes = FALSE, main = "Math can be beautiful ...",
      xlab = expression(cos(r^2) * e^{-r/6}))
contour(z, add = TRUE, drawlabels = FALSE)

Any ideas what is causing this?  I can't seem to figure it out.  I'm not sure the bmp image can/will be posted, so maybe you can just take my word for it.  It is a gridding pattern in white, that appears over the plot area only.  Vertical lines are every 4 units, evenly spaced.  Horizontal lines appear at every unit, then stop for a while (6-7 units, then appear every unit for 4-5 units).  Simple plots like plot(x,y) do not seem to produce it, or at least I can't see it.  Any ideas are helpful.

Justin M. Balko, Pharm.D., Ph.D.
Research Fellow, Arteaga Lab
Department of Medicine
Division of Hematology/Oncology
Vanderbilt University
777 Preston Research Building
Nashville TN, 37232-6307
Ph: 615-936-1495

More information about the R-help mailing list