Reputation: 8621
I'm looking for a way to duplicate the kind of Heat Table shown below with R (and possibly ggplot2). Specific time axis are irrelevant; any rectangular table should do.
I've tried to search for Heat map
and Heat table
in Google, but couldn't find any R package that did the trick.
Thoughts?
Upvotes: 2
Views: 872
Reputation: 145755
require(ggplot2)
df <- data.frame(vaxis = rep(c(letters[1:5], "top"), each = 4),
haxis = rep(c(letters[6:8], "right"), times = 6),
value = rpois(24, lambda = 10))
df$color <- factor(ifelse(df$vaxis == "top" | df$haxis == "right", 1, 0))
ggplot(df, aes(x = haxis, y = vaxis, size = value, color = color)) + geom_point()
Just get your data in a similar format. You could write a function to make the "top" and "right" values normalized marginal sums. Of course lots of tweaks are possible in naming, legends, theme, etc.
Upvotes: 8