Skip to content
Prev 366844 / 398502 Next

graphical behavior of a table of numbers

Duncan, thank you for locating the problem.
Martin, thank you for explaining the behavior and for the first pass
at fixing it.
With the fix, now the x-axis has ticks at all integers, and tick labels at
c(-81,-67,-53,-39,-25,-11,0,9,19,31,43,55,67,79)
This is with R-3.3.2, as I interpret your fix to be to only the
R-intro.pdf manual with no change
to the code of any of the functions.
More work has to be done to repair the example.

I recommend
plot(as.numeric(fr) ~ as.numeric(names(fr)), type="h",
xlab="Determinant", ylab="Frequency")

The slightly more obvious solution doesn't work
Error in plot.table(c(-81, -80, -79, -78, -77, -76, -75, -74, -73, -72,  :
  invalid table 'x'

## It is possible to change graphics:::Axis.table to
if (is.num) axis(side, ...)
## and that would make the x-axis for the determinant example
plot(fr, type="h", xlab="Determinant", ylab="Frequency")
## look sensible, but would
## be less appropriate for the following example.

## The current behavior of Axis.table makes sense in this example
tt <- as.table(array(c(10,20,30), dimnames=list(c(100, 120, 200))))
tt
plot(tt)

On Mon, Jan 30, 2017 at 5:38 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote: