Skip to content
Prev 8475 / 63424 Next

Small change to plot.xy

OK -- so there are two objections to the proposal:

1) The factor might be a colour specifier

2) Using codes is not a good idea because there are only 8 colours
available for an integer argument to col.

I can see that both of these have merit, but I think they are both easy
to work around, if necessary.  No-one has disagreed that it's natural to
want to pass a factor to col, and I believe that the vast majority of
times when this occurs the factor is not designed explicitly to paint
the points.

I think I would let the first objection pass.  Using codes to coerce the
factor we still get different colours for different factors, just not
the specified colours.  This is not right, but it's rarely a disaster
either and should be easy to spot for anyone who is expecting to see
"slateblue" and gets "red".

As for the second objection, I think this is valid and should be
addressed, but at the same time it is a different problem.  I often
wondered why col = 1 was black (not really a colour at all, and not very
good for boxplots) and, more pertinently, why col = 2 is red and col = 3
is green: isn't the most common form of colour-blindness red/green?  At
the very least, let's not have them next to each other in the list!  We
have 657 named colours to choose from: why not have a explicit "int2col"
function that provides a bigger and better table?

More-or-less the same arguments also apply to pch.

Jonathan.
Jonathan Rougier wrote: