Skip to content

plot.formula and pch= (PR#149)

2 messages · Peter Dalgaard, Jonathan Rougier

#
I'm not sure exactly where to point my finger with this one, but there
is a nasty surprise to the unsuspecting user.

There is no check on the length of the vector passed in the pch=
argument to plot, it is just recycled as necessary:

plot(1:10,1:10,pch=1:2)

gives alternating circles and triangles. 

The nasty bits come up especially with plot.formula:

x<-1:10;y<-1:10 
plot(y~x,subset=x%%2==1,pch=x%%2)

- and the plotting symbols are *not* all the same. Even more
  pernicious, if missing values are involved:
gives you the wrong symbols (in practice, this messes up things like 
plot(height~age,pch=sex) rather badly!).

It would help to get a warning that the lengths don't match, but are
there any good uses of the recycling of pch?
#
On Thu, 25 Mar 1999 p.dalgaard@biostat.ku.dk wrote:

            
<...>
There might be a case for it in time series graphs, where there are
periodic characteristics of the data (days of the week, for example).

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be 
 weighed in the scale with what we know"  (Meredith, 1879, The Egoist)


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._