[R] drawing dot plots with size, shape affecting dot characteristics

Michael Bedward michael.bedward at gmail.com
Thu Aug 12 08:32:28 CEST 2010


Try running this and see if it does what you want. It just uses plain
old plot with the cex arg for size and the col arg for colour...

greyDots <- function() {
  # make up some data
  x <- runif(50, 0, 10)
  y <- runif(50, 0, 10)
  valueMax <- 100
  value <- sample(valueMax, 50)

  # edit these to taste
  maxDotSize <- 5
  maxGreyLevel <- 0.8

  plot(x, y, pch=16, xlim=c(0,10), ylim=c(0,10),
       cex=maxDotSize * value / valueMax,
       col=grey(maxGreyLevel * value / valueMax))
}


On 12 August 2010 13:14, Brian Tsai <btsai00 at gmail.com> wrote:
> Hi all,
>
> I'm interested in doing a dot plot where *both* the size and color (more
> specifically, shade of grey) change with the associated value.



More information about the R-help mailing list