I'm getting spurious white verticle/horizontal lines from a pdf generated through R. I'm using Windows 7, R 32bit 2.15.2. This has popped up in the forums before, but I couldn't find any fixes that worked for me. Different versions of R give the same results, as well as other windows boxes. The Cairo package didn't help. I need a pdf because I'm using the figure in a latex document (eps would work too, though it'd be slightly annoying). Here's a MWE:
library(MASS)
data.x <- runif(50);
data.v1 <- runif(50);
x <- matrix(rep(0:50/50,51),nrow=51,ncol=51);
y <- t(x);
theta <- 50;
x0 = 0.2; y0 = 0.5;
z <- abs(sqrt(((x-x0)*cos(theta)+(y-y0)*sin(theta))^2 + ((y-y0)*cos(theta)+(x- x0)*sin(theta))^2)-1);
Palette <- colorRampPalette(c("lightgrey","black"),
interpolate="spline" )
Levels <- (0.1*(0:10))
pt.color <- "black";
filled.contour(x=0:50/50,y=0:50/50,z=z,levels=Levels,
xlim=c(0,1),ylim=c(0,1),
color.palette=Palette, xlab="X",ylab="V",
plot.axes={axis(1);axis(2);
points(data.x,data.v1,pch=19,col=pt.color, cex=.5);
contour(x=0:50/50,y=0:50/50,z=z,levels=Levels,labcex=1.5,
col=grey(0.5),lwd=1.5,add=TRUE, labels=" ", method="flattest"
);
contour(x=0:50/50,y=0:50/50,z=z,levels=Levels,lwd=1.5,labcex=1.5,
lty=0,col=grey(0.2),add=TRUE, method="flattest"
);
}
)
dev.copy(pdf,file="contour_see_diff.pdf")
dev.off()