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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 19 Feb 2008 19:00:33 -0500

The output from xy.coords is not being sent to Axis since if it were then Gavin's code earlier in this thread, which does work, would not.

On Feb 19, 2008 4:08 PM, Mark Difford <mark_difford_at_yahoo.co.uk> wrote:
>
> Hi Stiffler,
>
> >> I was wondering why the plot() command ignores the datatype when
> >> displaying axis labels...
>
> plot() doesn't ignore the datatype:
>
> > x <- as.integer(c(1,2,3))
> > y <-x
> > typeof(x)
> [1] "integer"
> > mode(x)
> [1] "numeric"
>
> plot(x,y) calls xy.coords(), which recasts x as: x = as.double(x), which is
> fine, since x is (also/primarily) numeric.
>
> ???
>
> See ?double, sub: "Note on names".
>
> HTH, Mark.
>
>
>
> Stiffler wrote:
> >
> > 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-labels--tp15562325p15567499.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.
>



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. Received on Wed 20 Feb 2008 - 00:04:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Feb 2008 - 00:30:16 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.

list of date sections of archive