mwtoews at sfu.ca
2007-Dec-06 21:50 UTC
[Rd] End of whiskers of boxplots are repeated on PDF device (PR#10499)
Full_Name: Michael Toews Version: 2.61 OS: WinXP SP2 Submission from: (NULL) (142.58.206.114) Using boxplot on a PDF device with more than one group (or boxes) produces multiple (and overlain) 1st and 3rd quartile ticks. There are exactly the multiple of boxplot groups as there are of each 1st and 3rd quartile ticks for each boxplot (drawn as a horizontal line at the end of each boxplot), which is (groups^2)x2 tick marks in total drawn for the device region. For example, a device with 4 boxplots: dat <- data.frame(f=factor(rep(1:4, 10)), x=rnorm(40)) pdf("test.pdf") plot(dat) dev.off() Since the ticks are overlain, the problem is not apparent when viewed in a PDF reader, but if one were to open the PDF in either CorelDraw or Adobe Illustrator[*], it is clear that there are 4 ticks for the 1st and 3rd quartile marks. This example produces (4^2)x32=64 marks, which is 58 too many. In other examples that use 86 boxplots, there are (86^2)x2=14792 ticks, of which only 2x86 are needed, the rest are redundant. [*] I'm not familiar with any OSS capable of editing PDFs, however you can see the tick marks in the PDF file through any text editor on lines 54-61, 77-84, 100-107, and 123-130. The tick marks alternate from 1st to 3rd each of the four times, so deleting the bottom 6 lines in each group removes the redundancy. I have also tested the example using the postscript device, but it seems fine (the skeleton of the boxplots appear to be compound paths, so are drawn very differently from a low-level graphics standpoint). --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 2 minor = 6.1 year = 2007 month = 11 day = 26 svn rev = 43537 language = R version.string = R version 2.6.1 (2007-11-26) Windows XP (build 2600) Service Pack 2.0 Locale: LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252 Search Path: .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base
Michael Toews
2007-Dec-06 22:33 UTC
[Rd] End of whiskers of boxplots are repeated on PDF device (PR#10499)
As a quick follow up, this problem is apparent in the Postscript device too (and possibly other vector devices). For example: dat <- data.frame(f=factor(rep(1:4, 10)), x=rnorm(40)) postscript("test.ps") plot(dat) dev.off() In Adobe Illustrator, the compound path needs to be "released" to see the extra outer whisker ticks. In the "test.ps" file, the first occurrence (for the first boxplot) is on lines 143-150, and repeats are on lines 151-174. +mt
Michael Toews
2007-Dec-13 17:00 UTC
[Rd] End of whiskers of boxplots are repeated on PDF device (PR#10499)
I've identified the problem for this issue, which is simple to fix. Please see and apply the attached patch. Thanks. +mt -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: boxplot_patch.txt Url: https://stat.ethz.ch/pipermail/r-devel/attachments/20071213/1e39d176/attachment.txt