Dear R People: When using the jpeg function for plotting, is there a way to set the size in inches, please? There is an option for width and height in pixels, but not inches. Any suggestions would be welcome!!!!! R Version 2.2.1 Windows Thanks in advance! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: hodgess at gator.uhd.edu
On Tue, 2006-02-28 at 16:10 -0600, Erin Hodgess wrote:> Dear R People: > > When using the jpeg function for plotting, > is there a way to set the size in inches, please? > > There is an option for width and height in pixels, but > not inches. > > > Any suggestions would be welcome!!!!!The problem is that the size of the resultant image when using bitmaps is entirely dependent upon the resolution (in pixels per inch) of the device upon which it is displayed. This is also referred to as dpi or dots per inch. Thus, for example, on my system I have a dual display configuration. The laptop internal LCD (15 inch diag.) is running at 1600x1200 with a dpi of 133. My external LCD display is a 20.1 inch diag., also at 1600x1200, with a dpi of 98. Thus, a JPEG image that is 400 pixels x 400 pixels will be roughly 3 inches square on my laptop, but roughly 4 inches square on the external display. You need to know the target dpi of the display device and then calculate the required pixels from there. An alternative is to use the bitmap() function, where you can specify height and width arguments, but also need to define the 'res' setting, which is the dpi desired. Even here, the basic calculation process is the same: Inches = Pixels / DPI HTH. Marc Schwartz
On Tue, 28 Feb 2006, Erin Hodgess wrote:> Dear R People: > > When using the jpeg function for plotting, > is there a way to set the size in inches, please? > > There is an option for width and height in pixels, but > not inches.Further to Marc Schwartz's answer, you can make use of the 'res' argument of jpeg() to specify the number of pixels per inch, but it is not very likely that your JPEG viewer will take much notice of it. (Some may make use of it when printing, but none that I know of does when displaying on screen. As you can see in the comments in ?windows, it can be impossible to get reliable information from the OS about screen resolution.) You have to design JPEGs for the intended application. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595