Mark Wilkinson <wilkinsonmr <at> gmail.com> writes:

> I'm using panel.polygon inside a custom panel function to generate
> filled polygons for an xyplot.  Everything is as expected until I
> specify a value < 1 for alpha to fill with a semi-transparent color
> and output to pdf.  The plot symbols appear malformed.  Am I doing
> something wrong here?
> 
> Here is an example (pdfs are attached):
...

I think there is a long-standing problem with pdf (on Windows?). My
workaround for this case:


library(lattice)
library(Cairo)
ex.data <- data.frame(x = sort(runif(10)),
                      y = rnorm(10))

## plot a semi-transparent polygon
ex.panel2 <- function(x, y, alpha) {
    yy.up <- y + 0.25
    yy.lo <- y - 0.25
    panel.polygon(c(x, rev(x)), c(yy.up, rev(yy.lo)),
                  border = NA, col = "lightblue", alpha = 0.5) # note change
    panel.xyplot(x, y, type = "p")
}

## output to pdf (symbols are now malformed)
CairoPDF(file = "plt2.pdf")
#trellis.device(device = pdf, color = TRUE, file = "plt2.pdf")
xyplot(y ~ x, data = ex.data, panel = ex.panel2)
dev.off()

______________________________________________
R-help@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.

Reply via email to