[R] wmf screen resolution problem!!!

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Dec 8 06:38:52 CET 2013


On 07/12/2013 12:46, Venkat Karthik wrote:
> Dear colleagues,
>
> For the past two weeks we have been struggling to create a proper image
> with stable pixels, height & width from R for various screen resolutions.

You cannot do that: it is a function of the format and how Microsoft's 
GDI works.

> We are trying to generate a wmf image with fixed pixels, fixed height &
> fixed width. But the problem we are facing is that when the same code is

Why?  .wmf is only useful if it is a vector file, and 'pixels' then do 
not matter.

> run on a different screen resolution the dimensions of the image are no
> longer the same.
>
> We would like to generate an image with height=16.6 cm and width=25 cm.
> Example code:
> ##Width & height in inches
> height <- 6.53
> width  <- 9.84
> h <- height + (height*0.128)  #Correcting the height so that when inserted
> into word doc height in the Original size is 16.6cm
> w <- width  + (width*0.0570) #Correcting the width so that when inserted
> into word doc width in the Original size is 25cm
> win.metafile("path to save\\test.wmf", height=h, width=w, restoreConsole =
> TRUE)
> boxplot(1:100)
> dev.off()
>
> When this image is generated on a screen resolution
> *1280x1024* ==> height =16.6cm   ; width=25cm   ;  pixels=999x708
> *1920x1080 *==> height =15.73cm ; width=16.6cm ; pixels=999x708
>
> Is it possible to keep all the 3 things fixed across different screen
> resolutions?
>
> Please find attached the images generated in the 2 resolutions.
>
> It would be of great help if anyone could suggest what could be done.
>
> Thanks in advance!!!
>
> Regards,
> Karthik
>
>
>
> ______________________________________________
> 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.
>


-- 
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



More information about the R-help mailing list