[Rd] barplot() does not draw bars correctly in R 1.9.0 (PR#6777)
Achim.Zeileis at wu-wien.ac.at
Achim.Zeileis at wu-wien.ac.at
Fri Apr 16 15:52:01 CEST 2004
On Fri, 16 Apr 2004 11:40:46 +0200 (CEST) phgrosjean at sciviews.org wrote:
> Bars are not stacked, but superimposed. This happens even with the
> first example of barplot:
>=20
> tN <- table(Ni <- rpois(100, lambda=3D5))
> r <- barplot(tN, col=3D'gray')
AFAICS, this problem occurs exactly for 1-way tables like above. If
barplot(as.vector(tN), col =3D "gray")
is used instead, everything is as it was in 1.8.1. The reason is that in
the new version of barplot.default the following code (which
remained unchanged) does not do anymore what do what one would want:
if (is.vector(height)) {
height <- cbind(height)
beside <- TRUE
}
else if (is.array(height) && (length(dim(height)) =3D=3D 1)) {
height <- rbind(height)
beside <- TRUE
}
that is, vectors and 1-way tables are treated differently which lead to
the problem. Using cbind() instead of rbind() in the second half,
overcomes this problem.
However, the colors are then chosen in the same way as for vectors,
resulting in different colors than in R 1.8.1. Maybe the default color
choice should then be modified as well.
Z
> --please do not edit the information below--
>=20
> Version:
> platform =3D i386-pc-mingw32
> arch =3D i386
> os =3D mingw32
> system =3D i386, mingw32
> status =3D
> major =3D 1
> minor =3D 9.0
> year =3D 2004
> month =3D 04
> day =3D 12
> language =3D R
>=20
> Windows XP Professional (build 2600) Service Pack 1.0
>=20
> Search Path:
> .GlobalEnv, package:methods, package:stats, package:graphics,
> package:utils, Autoloads, package:base
>=20
> .......................................................<=B0}))><....
> ) ) ) ) )
> ( ( ( ( ( Prof. Philippe Grosjean
> \ ___ )
> \/ECO\ ( Numerical Ecology of Aquatic Systems
> /\___/ ) Mons-Hainaut University, Pentagone
> / ___ /( 8, Av. du Champ de Mars, 7000 Mons, Belgium
> /NUM\/ )
> \___/\ ( phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
> \ ) email: Philippe.Grosjean at umh.ac.be
> ) ) ) ) ) SciViews project coordinator (http://www.sciviews.org)
> ( ( ( ( (
> ...................................................................
>=20
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>=20
More information about the R-devel
mailing list