Skip to content

Graphics-Device-Size vs. Window-Size

3 messages · Jens Oehlschlägel, Martin Maechler

#
I want to layout on screen a graphic bigger than the screen (width=16.53543,
height=11.69291) but strwidth() and strheight() give wrong results.
axes=FALSE)
[1] 0.08471151
[1] 0.1856643

strwidth() obviously tells me how much space a text needs ON THE SCREEN, not
on the desired device size. Can someone enlighten what is the best way to
solve this?

Regards


Jens Oehlschl?gel

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
15 days later
#
on Wed, 8 Nov 2000 11:52:38 +0100

    Jens> I want to layout on screen a graphic bigger than the screen
    Jens> (width=16.53543, height=11.69291) but strwidth() and strheight()
    Jens> give wrong results.

    >> x11(width=42/2.54, height=29.7/2.54, pointsize=12)
    >> plot(1,1, type="n", xlim=c(0, 1), ylim=c(-1, 0), xlab="", ylab="",
    Jens> axes=FALSE)
    >> strwidth("Whatever")
    Jens> [1] 0.08471151
    >> # Now resize the window and repeat
    >> strwidth("Whatever")
    Jens> [1] 0.1856643

    Jens> strwidth() obviously tells me how much space a text needs ON THE
    Jens> SCREEN, not on the desired device size. Can someone enlighten
    Jens> what is the best way to solve this?

Since you are mentioning this again:

Have you looked at  help(strwidth) 
and seen the three different kinds of units that you can ask for ?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi Martin,

Thank you.
Yes. Paul already mentioned this and I already checked it and I already said
that none of these options help. None of them lies, but none of them does
the job. The crucial point is, that resizing the window does NOT CHANGE the
font size, does CHANGE par("fin") and thus does CHANGE the proportion of the
device needed to show the text (under linux AND under windows).

This means that resizing a window (keep in mind that big devices are
automatically resized at creation time) causes

strwidth("sometext", units="user")   to report CHANGED     space
requirements in user coordinates
strwidth("sometext", units="figure") to report CHANGED     space
requirements as fraction of par("fin")[1]
strwidth("sometext", units="inches") to report NON-CHANGED space
requirements in inches

None of those tells you, which space requirements "sometext" would have
relatively to the originally intended device size or it's user coordinates.
(Yes, I know that I could calculate that, by administering two versions of
device sizes, by calculating two versions of all text sizes, but it is quite
nonsense to have the user do all that).

As I understood Ross Ihaka's mail, this will be improved in one of the
future versions of R, so that we get a real separation of representation
(device) and presentation (screen window), such layer separation has prooved
to be useful in other systems like LaTeX.

BTW: this was a thread on r-devel, not on r-help.

Regards


Jens
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._