R-alpha: plot(..... sub = 'sub title') does not work.

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 17 Oct 1997 17:22:37 +0200


The `sub'  is simply disregarded when given as argument to plot(..)
I think, we'd want it to be passed to title.

In the code of  plot.default, it seems clear how this happens.
We have

> plot.default
function (x, y = NULL, type = "p", col = par("fg"), bg = NA, 
        pch = par("pch"), xlim = NULL, ylim = NULL, log = "", 
        axes = TRUE, frame.plot = TRUE, panel.first = NULL, panel.last = NULL, 
        ann = par("ann"), main = NULL, xlab = NULL, ylab = NULL, 
        cex = par("cex"), lty = par("lty"), lwd = par("lwd"), 
        ...) 
{

	..........

        plot.new()
        plot.window(xlim, ylim, log, ...)
        panel.first
        plot.xy(xy, type, col = col, pch = pch, cex = cex, bg = bg, 
                lty = lty, lwd = lwd, ...)
        panel.last
        pars <- list(...)
        if (axes) {
                axis(1, pars = pars)
                axis(2, pars = pars)
                if (frame.plot) 
                        box(...)
        }
        if (ann) 
                title(main = main, xlab = xlab, ylab = ylab, 
                        pars = pars)
        invisible()
}

> title
function (main = NULL, sub = NULL, xlab = NULL, ylab = NULL, 
        ...) 
.Internal(title(as.char.or.expr(main), as.char.or.expr(sub), 
        as.char.or.expr(xlab), as.char.or.expr(ylab), ...))
	
-------

It is not clear to me which function should be fixed:

Either add 'sub=NULL' to the argument list of plot.default,

1)	 and all will work, but we have yet another arg

or

2)	change the .Internal(title(.....))  such that it also looks for a 
	'sub' arg in its "..." arguments and takes that one if it exists.


To patch plot.default is easier to implement,
but improving (internal) title would have potential
benefits to many other circumstances...

-- Martin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel 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-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-