I am trying to construct a het map type of plot with rectangular bins
colored to indicate the number of records for a given value within
different categories.  I am getting close to what I want with ggplot2 and
stat_bin2d.  However if you run the code you will se below that the
placement of the bins on the graph is incorrect.  Categories A and C should
have equal overlap with category B but they don't.  Any idea what I am
doing wrong / better approaches for this?

library(ggplot2)
mt <- as.data.frame(matrix(rep(c("A", "B", "C"), each = 10), 30, 2))
mt[, 2] <- c(rep(18, 5), rep(20, 5), rep(20, 10), rep(20, 5), rep(22,5))
colnames(mt) <- c("group", "count")
ggplot(data=mt,aes(x=mt$count, y=mt$group)) + stat_bin2d(binwidth = c(.5,
.5))



cheers
Heath

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to