From Greg.Snow at imail.org  Tue Jul 26 23:31:56 2011
From: Greg.Snow at imail.org (Greg Snow)
Date: Tue, 26 Jul 2011 15:31:56 -0600
Subject: [Rd] default par
In-Reply-To: <BAY149-W36D4791B652A1054D0570DD54E0@phx.gbl>
References: <BAY149-W36D4791B652A1054D0570DD54E0@phx.gbl>
Message-ID: <B37C0A15B8FB3C468B5BC7EBC7DA14CC6349E11E71@LP-EXMBVS10.CO.IHC.COM>

For number 1, one option is to use the setHook function with the hook in plot.new.  Using this you can create a function that will be called before every new plot is created, your function could then call par with the options that you want, this will set the parameters on all devices.  However it could cause problems if you ever wanted to change those values for a plot, your call to par would be overwritten by the hook function.

For number 2, S-PLUS did have the default to warn when points were outside the plotting region, this was annoying when people intentionally used the limits to look at only part of the data, so I don't think it would be popular to bring back this behavior in general.  You can use the zoomplot function in the TeachingDemos package to expand the range of your current plot to show data that was outside the limits, or I believe that if you use ggplot2 the plots will be expanded automatically to include all the data (unless you limit the range in the call).  You could also write your own points or plot function that would check the range and give warnings then call the regular points or plot function.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of Berry Boessenkool
> Sent: Friday, July 22, 2011 7:47 AM
> To: r-devel at r-project.org
> Subject: [Rd] default par
> 
> 
> 
> Hello dear R-developers,
> 
> two questions on an otherwise magnificent program:
> 
> 1)
> Is there a way to set defaults for par differently than R offers
> normally?
> I for example would like to have las default to 1. (or in the same
> style, sometimes type in plot() could be "l" per default).
> 
> Tthe following post desribes pretty much exactly that:
> https://stat.ethz.ch/pipermail/r-help/2007-March/126646.html
> It was written four years ago, but it seems like there has been no real
> elegant solution.
> Did I just miss something there? If so, could someone give me an
> update?
> If not, is there a chance that such a feature? would be added to future
> R-versions?
> I could live with the idea to assign the par$element default in
> Rprofile.site.
> 
> 2)
> Would it appear sensible to have R give a warning, when points() is
> used, and some/all values are out of plotting range in the active
> device?
> It has happened some times that I needed quite a bit of time to figure
> out why nothing was plotted.
> Such a warning (or maybe even a beep?) would give users the clue to
> look at the values right away...
> (What I mean is this: ?? plot(1:10)? ; points(11,3)??? just in case
> it's unclear)
> 
> 
> Thanks ahead for pondering, and again: R ist the most beautiful thing I
> discovered in the last three years.
> Keep up the good work!
> 
> Berry
> 
> -------------------------------------
> Berry Boessenkool
> University of Potsdam, Germany
> -------------------------------------
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] default par
Greg Snow