pch and mkh bug PR#225
s-harker@adfa.edu.au
s-harker@adfa.edu.au
Thu, 15 Jul 1999 04:28:02 +0200 (MET DST)
I am sorry about the problem caused by my first attempt at reporting a
bug. This is a followup to my report PR#225, hopefully being more
useful. By not I have a better understanding of the problems being
reported.
I wish to report one bug relating to plot character and to mention two
other possible bugs (these may relate to differences between R and S)
I have noticed with R. We have recently installed R and I am
converting some scripts I had previously used with a very old version
of S (not Splus). The R version information is:
platform sparc-sun-solaris2.5.1
arch sparc
os solaris2.5.1
system sparc, solaris2.5.1
status
status.rev 0
major 0
minor 64.2
year 1999
month July
day 3
language R
In the following I will be quoting some extracts from R A Becker, J M
Chambers and A R Wilks _The New S Language_, Wadsworth & Brooks/Cole
1988, isbn 0-534-09192-X. We have a copy of this book since, although
our departmental server did not update from S to Splus, the campus
server did. I am using this as an authority to report some of the
following as being bugs.
(1) First the boxes drawn using `points()' via the following example
Y <- c(13.75, 10.50, 7.25, 4.0)
X <- c(1, 2, 3, 4)
plot(X,Y,
xlim=c(0,5),ylim=c(0,15),type="n")
points(X,Y,pch=0,mkh=0.02)
points(X,Y,pch=0,mkh=1.0)
points(X,Y-1,pch=0,cex=4.0)
points(X,Y-1,pch=0,cex=0.02)
are of a size that indicated that the mkh value is being ignored (the
upper set of boxes). This can be fixed by using cex (the lower set of
boxes). However, the S manual states that `mkh' gives the height in
inches of mark symbols drawn when `pch' is given as a number. This
comment is also made in the help for the `par' function within R. This
would appear to be a bug, using `cex' is correct only when giving a
character.
(2) The plotting of axis labels on an axis becomes confused if the
`at' vector is descending. For exaample, consider the following:
labels <- c("A", "B", "C", "D")
Y <- c(13.75, 10.50, 7.25, 4.0)
X <- c(1, 2, 3, 4)
plot(X,Y,
xlim=c(0,5),ylim=c(0,15))
axis(side=4,at=Y,labels=labels)
According to the S manual `label[i]' is plotted at coordinate `at[i]'.
Although S (or R) plot the vector in ascending order this still worked
(in old S, anyway), it may have been a feature. However, R appears to
sort `at[i]' but not do a corresponding sort on label[i]. The R help
does not make the statement about plotting `label[i]' at coordinate
`at[i]', so this may be a difference between S and R. It can be
overcome by appropriate pre-sorting of the two vectors.
(3) The use of `mtext' only works for a string, not for a vector of
strings. For example, the following commands.
labels <- c("A", "B", "C", "D")
Y <- c(13.75, 10.50, 7.25, 4.0)
X <- c(1, 2, 3, 4)
plot(X,Y,
xlim=c(0,5),ylim=c(0,15))
mtext(text=labels, side=4, line=0.5, at=Y)
plots only the first of the elements of `labels'. Again, this may
reflect a difference between S and R. The S manual states that `text'
is a character vector to be plotted and `at' is an optional vector of
positions. However, the R help states that `text' is a character
string and `at' gives the location in user coordiates. This can be
overcome by plotting `labels[i]' at `at[i]' within a loop.
--
Stephen Harker s-harker@adfa.edu.au
School of Physics Baloney Baffles brains: Eric Frank Russell
University College http://www.adfa.edu.au/physics/s-harker/
UNSW, ADFA
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._