[R] screen resolution effects on graphics
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Aug 28 20:55:49 CEST 2006
The problem then was likely just with my regexp. The last revision
that I posted should hopefully work on your machine (all of them
worked on mine).
On 8/28/06, Charles Annis, P.E.
<Charles.Annis at statisticalengineering.com> wrote:
> Gabor:
>
> Success! (Sort of) Running outside R in the DOS window produces
>
> C:\Program Files\R\R-2.3.1\bin>cscript displayconfiguration.vbs
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> Name: NVIDIA GeForce FX 5200
> Color depth: 32
> Horizontal resolution: 1280
> Vertical resolution: 1024
>
> I don't have immediate access to a machine with 800X600 native resolution so
> I can't compare.
>
> What's next?
>
> The problem isn't that a jpg produced on this machine looks crowed on an 800
> X 600 machine. It's that the same R code on this machine generates a
> crowded jpeg on the older machine. My hope was to check the capability of
> the current machine and make some modest adjustments to my R code to produce
> an acceptable jpg on any machine running it.
>
> Thanks.
>
>
>
> Charles Annis, P.E.
>
> Charles.Annis at StatisticalEngineering.com
> phone: 561-352-9699
> eFax: 614-455-3265
> http://www.StatisticalEngineering.com
>
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor Grothendieck
> Sent: Monday, August 28, 2006 2:21 PM
> To: Charles.Annis at statisticalengineering.com
> Cc: r-help
> Subject: Re: [R] screen resolution effects on graphics
>
> This is what happens when I run it in R 2.3.1:
>
> > as.numeric(gsub(".* ", "", grep("resolution",
> + shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE),
> + value = TRUE)))
> [1] 1280 1024
>
> The result is obviously dependent on your particular video
> card (I have a radeon). Try running it from outside of R and see
> what you get:
>
> cd \bin
> cscript displayconfiguration.vbs
>
> Also make sure you copied the code correctly from the web site
> and also try the second solution too just in case.
>
> Its possible that virus detection software will interfere since some
> antivirus programs prevent all vbscript routines from running.
>
>
> On 8/28/06, Charles Annis, P.E.
> <Charles.Annis at statisticalengineering.com> wrote:
> > Gabor:
> >
> > I am afraid I am demonstrating my lack of computer savvy.
> >
> > As you instructed, I downloaded the code, saved it as the file you
> > suggested, and executed this within R
> >
> > as.numeric(gsub(".* ", "", grep("resolution",
> > shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE),
> > value = TRUE)))
> >
> > The DOS window opened, some magic occurred in the blink of an eye, and the
> > DOS window closed. I haven't the foggiest idea what to do next since I
> can
> > see no evidence of having done anything.
> >
> > Thanks for your patience.
> >
> >
> > Charles Annis, P.E.
> >
> > Charles.Annis at StatisticalEngineering.com
> > phone: 561-352-9699
> > eFax: 614-455-3265
> > http://www.StatisticalEngineering.com
> >
> >
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch
> > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor Grothendieck
> > Sent: Monday, August 28, 2006 11:39 AM
> > To: Charles.Annis at statisticalengineering.com
> > Cc: r-help
> > Subject: Re: [R] screen resolution effects on graphics
> >
> > 1. Put the code from
> > www.microsoft.com/technet/scriptcenter/resources/qanda/jul05/hey0721.mspx
> > into, say, \bin\displayconfiguration.vbs, and then from R do this:
> >
> > as.numeric(gsub(".* ", "", grep("resolution",
> > shell('cscript \\bin\\displayconfiguration.vbs', intern = TRUE),
> > value = TRUE)))
> >
> >
> > or we can translate that into R to eliminate the need for a vbs routine
> > and then run it directly from R (although we will still need the indicated
> > dll):
> >
> > # must have GenericEnum.dll registered. That is, download and unzip:
> > # http://sunsite.univie.ac.at/rcom/download/GenericEnum.zip
> > # and register it: regsvr32 GenericEnum.dll
> >
> > library(RDCOMClient)
> > strComputer = "."
> > SWBemlocator <- COMCreate("WbemScripting.SWbemLocator")
> > objWMIService <- SWBemlocator$ConnectServer(strComputer,"\\root\\CIMV2")
> > colItems <- objWMIService$ExecQuery ("Select * from
> > Win32_DisplayConfiguration")
> >
> > lEnum <- COMCreate("GenericEnum.AutomationEnum")
> > lEnum[["Collection"]] <- colItems
> >
> > if (lEnum$SetFirst()) {
> > repeat {
> > cat(lEnum[["Item"]][["DeviceName"]], "\n")
> > cat(lEnum[["Item"]][["BitsPerPel"]], "\n")
> > cat(lEnum[["Item"]][["Pelswidth"]], "\n")
> > cat(lEnum[["Item"]][["Pelsheight"]], "\n")
> > if (!lEnum$SetNext()) break
> > }
> > }
> >
> >
> >
> > On 8/28/06, Charles Annis, P.E.
> > <Charles.Annis at statisticalengineering.com> wrote:
> > > My apologies for my oversight. I am using WindowsXP. The code that
> > > produces a nice-looking jpg (when viewed on my screen) produces cramped
> > > graphics on a 800 X 600 screen. I can change the spacings on the plot
> and
> > > remedy the situation for 800 X 600, but that looks awkward at 1280 X
> 1024.
> > >
> > > Thanks
> > >
> > > Charles Annis, P.E.
> > >
> > > Charles.Annis at StatisticalEngineering.com
> > > phone: 561-352-9699
> > > eFax: 614-455-3265
> > > http://www.StatisticalEngineering.com
> > >
> > > -----Original Message-----
> > > From: r-help-bounces at stat.math.ethz.ch
> > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of bogdan romocea
> > > Sent: Monday, August 28, 2006 10:55 AM
> > > To: Charles.Annis at statisticalengineering.com
> > > Cc: r-help
> > > Subject: Re: [R] screen resolution effects on graphics
> > >
> > > You forgot to mention your OS. This was asked before and if I recall
> > > correctly the answer for Windows was no. An acceptable solution (imho)
> > > is to edit the Rprofile.site files and add something like
> > > pngplotwidth <- 990 ; pngplotheight <- 700
> > > pdfplotwidth <- 14 ; pdfplotheight <- 10
> > > Then, use these values in your functions. It's manual, but you only
> > > need to do this once for each machine.
> > >
> > >
> > > > -----Original Message-----
> > > > From: r-help-bounces at stat.math.ethz.ch
> > > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> > > > Charles Annis, P.E.
> > > > Sent: Monday, August 28, 2006 8:50 AM
> > > > To: r-help at stat.math.ethz.ch
> > > > Subject: [R] screen resolution effects on graphics
> > > >
> > > > Greetings, R-Citizens:
> > > >
> > > > I have the good fortune of working with a 19" 1280 X 1024
> > > > pixel monitor. My
> > > > R-code produces nice-looking graphics on this machine but the
> > > > same code
> > > > results in crowded plots on an older machine with 800 X 600
> > > > resolution. In
> > > > hindsight this seems obvious, but I didn't anticipate it.
> > > >
> > > > My code will be used on machines with varying graphics (and memory)
> > > > capacity. Is there a way I can check the native resolution
> > > > of the machine
> > > > so that I can make adjustments to my code for the possible
> > > > limitations of
> > > > the machine running it?
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > Charles Annis, P.E.
> > > >
> > > > Charles.Annis at StatisticalEngineering.com
> > > > phone: 561-352-9699
> > > > eFax: 614-455-3265
> > > > http://www.StatisticalEngineering.com
> > > >
> > > >
> > > > ______________________________________________
> > > > R-help at stat.math.ethz.ch 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.
> > > >
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch 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.
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch 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.
> > >
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
> >
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
>
>
More information about the R-help
mailing list