Restore Vibration Tufte Moiré

Tufte gives a good bad example of why cross-hatching is distorted, a flicker effect ("Visual Display of Quantitative Information", 2001, p. 108) that looks like:

enter image description here

Although it is more clear. How can I reproduce this in R? Since this is not considered good practice, figuring out the easiest way to replicate this proves complexity.

+7
r plot
source share
3 answers

The abline option is used abline :

 plot(NA,NA, xlim=c(0,100), ylim=c(0,100)) for(i in seq(-15,600,6)) { abline(i, -3, lwd=6) } 

enter image description here

Change to Tyler: this is what I used exactly in the knitr document, as annoying as the original.

 plot(NA,NA, xlim=c(0,100), ylim=c(0,100), ylab=NA, xlab=NA, yaxt='n', xaxt='n', bty = "n") for(i in seq(-15,500,6)) { abline(i, -3, lwd=4) } 
+9
source share

polygon to the rescue:

 plot(0:1,type="n") polygon( x=c(1,1,2,2), y=c(1,0,0,1), density=10, angle=135, lwd=5, border=NA ) 

enter image description here

+9
source share

For completeness, here's the solution to ggplot2 , as always the problem is getting the right data ...

 hatch <- function(xsequence, ysequence, weight = 1) { require(ggplot2) df <- data.frame(x = c(rep(0, length(ysequence)),xsequence, xsequence, rep(max(xsequence), length(ysequence))), y = c(ysequence, rep(max(ysequence), length(xsequence)), rep(0, length(xsequence)), ysequence), group = seq_along(1:(length(xsequence) + length(ysequence)))) p <- ggplot(df, aes(x, y)) + geom_line(aes(group = group), size = weight) print(p + theme(panel.background = element_rect(fill = "transparent"), axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank())) } hatch(1:100, 1:40, 1.5) 

enter image description here

+6
source share

All Articles