[R] Bitmap file size problems
erich.neuwirth at univie.ac.at
Tue Sep 12 22:11:12 CEST 2006
I am experiencing some problems with the windows graphics device
and bitmaps. (Everything is done in R 2.3.1 on Windows XP)
As an example, I will use
It is not a pretty or meaningful graph, but it demonstrates the problem.
creates a bitmap file of size 303x207 which is somewhat strange
because it seems to use slightly different values for
pixels per inch horizontally and vertically.
(By the way, in my version of R 2.4.0alpha, the bitmap has size
The documentation warns that the graphics devices use
pixel per inch values reported by Windows, and that might be unreliable.
In my case,
produces the same image (of the same size) as before, so
Windows seems to report 96 for the pixels per inch value.
The next result surprised me:
produces a square graphics window and a bitmap file of size
303x303. (In R 2.4.0 alpha the size is 303x302).
In fact, when ypinch is given, height seems to be ignored
and the graphics windows height:width ratio is the
ypinch:xpinch ratio from the call to windows.
will produce a window which is higher than wide,
which is not what I expected after reading the docs.
(This also is true in R 2.4.0 alpha)
The alternative solution is to use dev2bitmap.
produces a bitmap of size 300x200 which is exactly what is to
be expected. In this bitmap, however, the leftmost
part of the image displayed in R's graphics window is cut off.
What is the best way of creating bitmaps of a given size
containing the full contents of an R graphics window?
Erich Neuwirth, Didactic Center for Computer Science
University of Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-9394
More information about the R-help