Dear All,
Thanks for all who gave me advice to tackle to problem to reset the default
value of the par()$font.
Sam Buttrey and Prof. Ripley both pointed out that the par(font=2) changes
the par()$font only works for the currently active device. Prof.. Ripley
suggested that I wrote a wrap function to change the par()$font. Sam Buttrey
just gave me a similar suggestion by revising the "graphsheet" function
(email attached below).
Now it appears that there is no easy way to reset the value of par()$font,
without invoking the graph device. The good thing is we can at least do it
for each graph. I was thinking about whether Splus has functions like
trellis.par.set. But that is basically very similar thing like a wrap up
function, right?
Max
#########
----- Original Message -----
From: Buttrey, Samuel (Sam) (CIV)
To: Max Zhao
Sent: Wednesday, March 08, 2006 11:29 AM
Subject: RE: [S] How to set the default par font = 2?
Hi Max,
You're right, that only works for the active device.
Here's something that worked for me. I made a local copy of the
graphsheet() function:
graphsheet <- graphsheet
and then, a few lines from the bottom, I changed the line
par (pch=-1)
to
par (pch=-1, font=2)
This seemed to work. What do you think?
Sam
----------------------------------------------------------------------------
--
From: Max Zhao [mailto:mzhao@homer.att.com]
Sent: Tuesday, March 07, 2006 1:21 PM
To: Buttrey, Samuel (Sam) (CIV)
Subject: Re: [S] How to set the default par font = 2?
Hi Sam,
I tried the .First function using
par (font=2)
The problem is: It is good only for the active graph device. So this is
not working!
And the command
assign ("par", tPar, where=1)
does not work either. The assignment change par$font to 2, but the
par()$font is still 1.
And I believe that is what I need to change.
In trellis graphics, there is something like "trellis.par.get" and
"trellis.par.set". I did not see anything like these. But Maybe I can
write codes similar to "trellis.par.set" to do the same thing.
Thanks for your help.
Max
----- Original Message -----
From: "Prof Brian Ripley" <ripley@stats.ox.ac.uk>
To: "Max Zhao" <mzhao@homer.att.com>
Cc: <s-news@lists.biostat.wustl.edu>
Sent: Friday, March 10, 2006 2:18 AM
Subject: Re: [S] How to set the default par font = 2?
> par() applies to the currently open graphics device.
>
> I don't know a way to change the defaults used when a device is first
> opened, but you could write a wrapper function to open a device and then
> change par().
>
> As for your example code, you need to call the par() function and not
> assign to an object of that name. If you had
>
> .First <- function() par(font=2)
>
> it would open a device (a graphsheet in your case) and then change
> par("font") on that device, put have no effect on subsquent devices.
>
>
> On Mon, 6 Mar 2006, Max Zhao wrote:
>
> > Dear All,
> >
> > I am trying to set the default font to 2, instead of the Splus default
> > 1. I tried to put it in my .First function so that every time Splus is
> > started, the default font would be 2 for each graphic device that is
> > invoked. Here is what I thought should work, but it did not. Does
> > anybody know how to solve the question?
> >
> > ################
> > .First_function()
> > {
> > tPar <- par()
> > tPar$font <- 2
> > assign("par", tPar)
> > }
> >
> > I am using Splus 6.2 in Windows XP environment.
> > Thanks in advance.
> > Max
> >
>
> --
> Brian D. Ripley, ripley@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
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
|