[R] Trellis device automatism [was "X11 device now needs ..?"]

Martin Maechler maechler at stat.math.ethz.ch
Fri Jan 17 11:27:03 CET 2003


>>>>> "Deepayan" == Deepayan Sarkar <deepayan at stat.wisc.edu>
>>>>>     on Thu, 16 Jan 2003 15:20:20 -0600 writes:

    Deepayan> On Thursday 16 January 2003 02:10 pm, Patrick Connolly wrote:
    >> On Wed, 15-Jan-2003 at 10:47PM -0600, Deepayan Sarkar wrote:
    >> |> On Wednesday 15 January 2003 07:35 pm, Patrick Connolly wrote:

    R version 1.6.2

    >> |> > Until this version, I've not had to explicitly start the x11 device.
    >> |> > Now, (at least with lattice plots), one is not automatically started
    >> |>
    >> |> Could you explain ? There's sometimes a warning, but I haven't seen
    >> |> the device not being opened.
    >> 
    >> On closer inspection, I see that it falls over earlier than the
    >> plotting itself.  It arises when I attempt to adjust some trellis
    >> settings.  This is the message:
    >> 
    >> Error in trellis.par.set(y, x) : No device is currently Active
    >> 
    >> 
    >> I notice that trellis.par.set has been changed this time.
    >> 
    >> "trellis.par.set" <-
    >> function (name, value, warn = TRUE)
    >> {
    >>  if (!is.list(value))
    >>     stop("value must be a list")
    >>  if (warn && is.null(dev.list()))
    >>     stop("No device is currently Active")
    >>  lattice.theme[[.Device]][[name]] <<- value
    >> }
    >> 
    >> 
    >> Previously, it had been only the last line.
    >> 
    >> The problem arises because dev.list() returns NULL if no device is
    >> open and thus the call to stop().
    >> 
    >> I don't know whether it would be a good idea to have trellis.par.set
    >> start the default device.
    >> 
    >> Ideas?

    Deepayan> Personally, I don't have any strong preferences,
    Deepayan> other than that the old behaviour (which silently
    Deepayan> did nothing, if I remember correctly) should be
    Deepayan> changed. Maybe we should go with S-PLUS behaviour,
    Deepayan> which gives an error if trellis.par.set() is
    Deepayan> called without an open device, but DOES start the
    Deepayan> default device if trellis.par.get() is
    Deepayan> called. This would mean that lset() would also
    Deepayan> start the device.

    Deepayan> Does that sound OK ?

partially.  I would provide this *at least*

Couldn't you even do more automatism, namely, start the default
device even for trellis.par.set().
This would be "compatible" with a non-lattice graphics call of
both
   par("<name>")    [ ~= trellis.par.get(.) ]    and
   par(<name> = ..) [ ~= trellis.par.set(.) ]    

no?

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list