[R] Why does plot() ignore the data type for axis labels?

Bert Gunter gunter.berton at gene.com
Tue Feb 19 18:51:38 CET 2008


I don't do "why" answers. Only how. Occasionally.

?plot.default  ##with the axes=FALSE argument. Then

?axis ## note the labels and at arguments.



Bert Gunter
Genentech Nonclinical Statistics


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Stiffler
Sent: Tuesday, February 19, 2008 9:18 AM
To: r-help at r-project.org
Subject: [R] Why does plot() ignore the data type for axis labels?


Hello,

I was wondering why the plot() command ignores the datatype when displaying
axis labels.  More specifically, if the data points are integers then the
axis labels should intuitively also be integers, right?

> x <- as.integer(c(1,2,3))
> y <-x
> typeof(x)
[1] "integer"
> plot(x,y)
>

The axis labels are 1.0, 1.5, 2.0, 2.5, 3.0  but if the integer type were
taken into account they would be 1, 2, 3.

PS what's the right way to get integer labels?
Z.
-- 
View this message in context:
http://www.nabble.com/Why-does-plot%28%29-ignore-the-data-type-for-axis-labe
ls--tp15562325p15562325.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list