Paul Johnson
2012-Aug-11 05:53 UTC
[R] device "mismatch", coordinates trouble with X11 and pdf devices
Greetings. I'm trying to understand a problem on a Dell Laptop. Details below, also uploaded the R working example that I pasted below. http://pj.freefaculty.org/scraps/testSymbols.R> sessionInfo()R version 2.15.1 (2012-06-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base ## Paul Johnson <pauljohn at ku.edu> ## 2012-08-10 ## ## I've got trouble with a mis-match between screen and pdf devices. ## Please run this and tell me if the point z's "marker" is on the ## intersection of the 2 circles for you. ## Why do I ask? On my Dell M4600 laptop, the marker (the pch=12) is ## on the intersection in the x11 device. See the screenshot: ## ## http://pj.freefaculty.org/scraps/testSymbol-01.png ## ## But the pdf output of same is not ## ## http://pj.freefaculty.org/scraps/testSymbol.pdf ## ## Notice one other weird thing. The circle sizes change. Maybe ## that's just the same weird thing. ## The X11 device is 7in x 7in. Right? Same as pdf. ## Why would coordinates from locator work in one display, but not the ## other? I've abused the symbols function somehow? locator is device ## dependant? ## Maybe its the video driver & LCD. ## This is a Dell Precision M4600. The LCD display is 13.6 inches x ## 7.6 inches (345.4mm x 193mm). By my reckoning, it is not precisely ## 16:9. The Nvidia card says the native resolution is 1920x1080, ## which is exactly 16:9. saveFile <- FALSE if(saveFile){ pdf(file="testSymbol.pdf", onefile=FALSE, paper="special", height = 7, width = 7) } plot(c(0,1), c(0,1), type = "n", xlab = "", ylab = "") x <- c(0.3, 0.3) y <- c(0.7, 0.7) points(x[1], x[2]) points(y[1], y[2]) symbols(x[1], x[2], circles=c(0.3), lty=2, inches = FALSE, add=TRUE) symbols(y[1], y[2], circles=c(0.3), lty=2, inches = FALSE, add=TRUE) ##Here's what I get from locator(1) on the intersection z <- list(x=0.4028, y=0.6485) if (is.null(z)) z <- locator(1) ## click on intersection of lines points(z, pch=12) text(x =0.96*z[[1]], y = 1.05*z[[2]], label="z") dev.off() -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu
peter dalgaard
2012-Aug-11 08:17 UTC
[R] device "mismatch", coordinates trouble with X11 and pdf devices
On Aug 11, 2012, at 07:53 , Paul Johnson wrote:> Greetings. > > I'm trying to understand a problem on a Dell Laptop. Details below, > also uploaded the R working example that I pasted below.The difference is not in locator() but in the circles, which in turn is due to different aspect ratios in the two devices. Notice that in the X11 plot, the circles are truncated top and bottom, whereas in PDF you see the entire perimeter. The axes are roughly the same. I.e. the circles on the X11 device would map onto ellipses on the PDF by vertical stretching. If you look carefully, you can see that the X11 plot is "less square" than the PDF. The distance between x ticks is bigger than that between y ticks. Notice that both _devices_ are square, but the plotting regions are not. This is because the margins remove 9.2 lines of text vertically but 6.2 lines horizontally. Consequentially, a difference in font size causes a difference in aspect ratio. plot() has an asp= parameter.... -pd> > http://pj.freefaculty.org/scraps/testSymbols.R > >> sessionInfo() > R version 2.15.1 (2012-06-22) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > ## Paul Johnson <pauljohn at ku.edu> > ## 2012-08-10 > ## > ## I've got trouble with a mis-match between screen and pdf devices. > ## Please run this and tell me if the point z's "marker" is on the > ## intersection of the 2 circles for you. > > ## Why do I ask? On my Dell M4600 laptop, the marker (the pch=12) is > ## on the intersection in the x11 device. See the screenshot: > ## > ## http://pj.freefaculty.org/scraps/testSymbol-01.png > ## > ## But the pdf output of same is not > ## > ## http://pj.freefaculty.org/scraps/testSymbol.pdf > ## > ## Notice one other weird thing. The circle sizes change. Maybe > ## that's just the same weird thing. > > ## The X11 device is 7in x 7in. Right? Same as pdf. > ## Why would coordinates from locator work in one display, but not the > ## other? I've abused the symbols function somehow? locator is device > ## dependant? > > ## Maybe its the video driver & LCD. > ## This is a Dell Precision M4600. The LCD display is 13.6 inches x > ## 7.6 inches (345.4mm x 193mm). By my reckoning, it is not precisely > ## 16:9. The Nvidia card says the native resolution is 1920x1080, > ## which is exactly 16:9. > > > > > saveFile <- FALSE > if(saveFile){ > pdf(file="testSymbol.pdf", onefile=FALSE, paper="special", height = 7, > width = 7) > } > > plot(c(0,1), c(0,1), type = "n", xlab = "", ylab = "") > > > x <- c(0.3, 0.3) > y <- c(0.7, 0.7) > points(x[1], x[2]) > points(y[1], y[2]) > > symbols(x[1], x[2], circles=c(0.3), lty=2, inches = FALSE, add=TRUE) > > symbols(y[1], y[2], circles=c(0.3), lty=2, inches = FALSE, add=TRUE) > > ##Here's what I get from locator(1) on the intersection > z <- list(x=0.4028, y=0.6485) > if (is.null(z)) z <- locator(1) ## click on intersection of lines > > > points(z, pch=12) > text(x =0.96*z[[1]], y = 1.05*z[[2]], label="z") > > dev.off() > > > > > -- > Paul E. Johnson > Professor, Political Science Assoc. Director > 1541 Lilac Lane, Room 504 Center for Research Methods > University of Kansas University of Kansas > http://pj.freefaculty.org http://quant.ku.edu > > ______________________________________________ > 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.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Possibly Parallel Threads
- shade overlapping portions of circles (or other shapes)
- R-2.15.2 changes in computation speed. Numerical precision?
- portableParalleSeeds Package violation, CRAN exception?
- Debian packaging and openblas related crash when profiling in R
- Problems booting from local hd