Jens Oehlschlägel
2000-Nov-09 10:41 UTC
[Rd] RE: [R] Graphics-Device-Size vs. Window-Size
Hi Paul, thank you for responding. I indeed overlooked, that units="inch" gives stable results, independent of resizing the graphics window on the screen. And indeed I would find some way fiddling around to get my graphic done. However I see a general problem here and I would like a general solution: Obviously we are dealing with two coordinate systems: the graphics device size (call it representation layer) and the window size on the screen (call it presentation layer). If I do any graphics programming, I do not want to depend on arbitrary window sizes. It is nice to know my device has 8 inches and that text x needs y inches in width. But the adress space in which plotting is done are the "user" coordinates. So, for the simplest example, specifying xlim=c(0,1) generates a stable reference WHICH DOES NOT CHANGE ON RESIZING THE GRAPHICS WINDOW. As strwidth(units="user") DOES CHANGE ON RESIZING THE GRAPHICS WINDOW the units arguably ARE NOT the user coordinates. I tend to believe this is a BUG. Same for units="figure". I also tend to believe, that resizing a graphics window should rescale the font size used ON SCREEN, because currently we have the following mixup of representation layer and presentation layer: if a certain text in cex=1 fills 50% width of my user coordinates on the device, and I decrease window size, with stable screen font size the same text now fills more than 50% width. This 'more' is reflected in strwidth(units='user'), but as said before, the units strwidth(units='user') gives are not user but user*(device/window). So if a special strwidth measure is needed which refers to the presentation layer it should be named accordingly. Those units='user' and units='figure' should return stable measures refering to the representation layer. Regards Jens> version_ platform Windows arch x86 os Win32 system x86, Win32 status major 1 minor 1.1 year 2000 month August day 15 language R -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi [This also a reply to "[Rd] Another inconsistency concerning device-size vs. window-size"] I will try to give a brief overview of the way R graphics devices (conceptually at least) work (to me at least). Yes a window (x11 or win32) is a device. Other devices are: postscript, png, jpeg, pictex, bmp. Windows are different to these other devices because they can be interactively resized. R treats a change in window size as a change in the (absolute) physical size of the device. Perhaps another way to respond to a window resize would be to retain the same physical device size and have scroll bars on the window, but I don't think this is still what you would want (?) Text size is most often specified (ultmately) as a physical (absolute) pointsize. The reason for this (I think) is that ultimately text has to be big enough to read. Thus strwidth() will return the same answer in any absolute set of units (e.g., "inch"). The correct interpretation of strwidth(mytext, "user") is that it is the physical size of the text _converted_ into user coordinates. Automatic resizing of text is a tricky issue. The text size is automatically resized by R in some cases (e.g., for multiple figures), but scaling text size continuously (e.g., with window size) does not tend to produce useful results (e.g., it is too easy to produce text which is too small to read). I suspect that I'm not providing you with the answer you want; I guess I'm trying to explain how R works so that you can do what you need to. Perhaps it would help me to help you more if you described the graphics task you are trying to achieve (?). With respect to the par("din") inconsistency, that _is_ undesirable behaviour. The correct behaviour is the second one. Could you please submit a bug report for this (including your example). Thanks Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._