[Rd] inconsistent matplot behaviour?

From: Joerg van den Hoff <j.van_den_hoff_at_fz-rossendorf.de>
Date: Thu 29 Jun 2006 - 12:29:26 GMT


I raised this question quite some time ago but it quitly went down the river. I'll give it a second try (before keeping my modified version of matplot for ever...):

matplot supports vectors (and/or character strings) for a number of arguments namely `type', `lty', `lwd', `pch', `col', `cex'. all of them act consistently in such a way that the first entries are used for plot of x-column 1 vs. y-column 1 and so forth.

for some reason `bg' is missing from this list (maybe simplyh forgotten?). this causes an, according to my mind, at least, undesirable (inconsistent) behaviour in calls like

matplot(x, y, type = 'b', pch = 21:23, col = 2:4, bg = 2:4)

(assuming x, y are 3-column matrices)

`col', `pch' and the other explicit arguments are interpreted on a 'per plot' basis whereas `bg' is transferred to plot.default and is therefore interpreted on a 'per point' basis. thus, `col' above sets the colors of the plotting symbols in the different line plots (say, column 1 to 3) whereas `bg' sets the colors alternating down each column of the data, i.e. within each line plot.

question: would'nt it be desirable and more consistent/intuitive if `bg' where treated on the same footing as the other explicit parameters, especially if combinations of `pch>=21' and `bg' are envisaged?

necessary changes to matplot are trivial:

3c3
< ..., add = FALSE, verbose = getOption("verbose"))

---

> bg = NULL, ..., add = FALSE, verbose = getOption("verbose"))
75a76,77
> if (length(bg) < k)
> bg <- rep(bg, length.out = k)
81c83,84 < pch = pch[1], col = col[1], cex = cex[1], ...) ---
> pch = pch[1], col = col[1], cex = cex[1], bg = bg[1],
> ...)
85c88 < pch = pch[i], col = col[i], cex = cex[i]) ---
> pch = pch[i], col = col[i], cex = cex[i], bg = bg[i])
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu Jun 29 22:34:05 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 30 Jun 2006 - 16:25:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.