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

2008-02-20 Thread Mark Difford
Hi Stiffler, Duncan Murdoch wrote: The point is that a scatterplot is a graph of real numbers, not of integers. Use a plot designed for a discrete data type if you don't want things displayed as their real values ... To drive home Duncan's point (not that it needs it) ...and to complete

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

2008-02-19 Thread Stiffler
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

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

2008-02-19 Thread Gavin Simpson
On Tue, 2008-02-19 at 09:17 -0800, 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))

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

2008-02-19 Thread Mark Difford
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

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

2008-02-19 Thread Stiffler
Gavin Simpson wrote: PS what's the right way to get integer labels? Do them by hand, if they are (numeric) integers plot(x,y, axes = FALSE) axis(2) axis(1, at = x) box() You could try writing your own Axis.integer function if doing the extra steps is a pain - something like:

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

2008-02-19 Thread Stiffler
Mark Difford wrote: I was wondering why the plot() command ignores the datatype when displaying axis labels... plot() doesn't ignore the datatype: [...] plot(x,y) calls xy.coords(), which recasts x as: x = as.double(x), which is fine, since x is (also/primarily) numeric. HTH, Mark.

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

2008-02-19 Thread Duncan Murdoch
On 19/02/2008 5:40 PM, Stiffler wrote: Mark Difford wrote: I was wondering why the plot() command ignores the datatype when displaying axis labels... plot() doesn't ignore the datatype: [...] plot(x,y) calls xy.coords(), which recasts x as: x = as.double(x), which is fine, since x is

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

2008-02-19 Thread Gavin Simpson
On Tue, 2008-02-19 at 14:40 -0800, Stiffler wrote: Mark Difford wrote: I was wondering why the plot() command ignores the datatype when displaying axis labels... plot() doesn't ignore the datatype: [...] plot(x,y) calls xy.coords(), which recasts x as: x = as.double(x), which

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

2008-02-19 Thread Gabor Grothendieck
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 [EMAIL PROTECTED] wrote: Hi Stiffler, I was wondering why the plot() command ignores the datatype when displaying