[R] Odd gridding pattern when plotting

David L Carlson dcarlson at tamu.edu
Fri Sep 30 20:54:15 CEST 2011


>From ?image

" Images for large z on a regular grid are more efficient with useRaster
enabled and can prevent rare anti-aliasing artifacts, but may not be
supported by all graphics devices. "

Adding useRaster=TRUE to the two image() calls gets rid of the white grid
lines.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Balko, Justin
Sent: Friday, September 30, 2011 10:43 AM
To: r-help at r-project.org
Subject: [R] Odd gridding pattern when plotting


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.
Thanks


Hi, 
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.
Thanks!


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

______________________________________________
R-help at r-project.org mailing list
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.



More information about the R-help mailing list