[Rd] colours in dotchart (PR#4343)

ligges at statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Mon Sep 29 14:01:15 MEST 2003

i.wilson at maths.abdn.ac.uk wrote:

> Problem:  neither fg or bg
> nor color work properly in dotchart.
> version:  R-1.7.1 for windows
> code which shows the errors:
> x <-
> matrix(rnorm(16),ncol=2,dimnames=list(paste("a",1:8,sep=""),c("before","afte
> r")))
> dotchart(x,fg="blue",bg="lightgrey")

That's *not* a bug! It is not documented that *all* graphical parameters 
known from par() do work in dotchart() or any other high-level function 
(you won't find many!).

Instead, use

  par(fg = "blue", bg = "lightgrey")

> dotchart(x,color=c("red","blue"))

That's *not* a bug! "color" is recycled, but in another way than you 

Instead, use

  dotchart(x, color = rep(c("red", "blue"), each = nrow(x)))

Please do submit bug reports if you are sure that's a bug. For questions 
use the mailinglist r-help, please.

Uwe Ligges

> Dr Ian J Wilson
> Lecturer in Statistics
> Department of Mathematical Sciences
> University of Aberdeen
> King's College
> Aberdeen, AB24 3UE
> Tel: +44(0)1224 272609
> Fax: +44(0)1224 272607
> I.Wilson at maths.aberdeen.ac.uk
> http://www.maths.abdn.ac.uk/~ijw

More information about the R-devel mailing list