I've thought of that. But I don't know how to properly caclulate the correct coordinates of ploygon points. I prefer to write a function works like geom_tile using geom_polygon which can solve coordinates automatically.
How To Plot Heatmap With Multiple Categories In A Single Cell With Ggplot2?
How to plot heatmap with multiple categories in a single cell with ggplot2? Heatmap plot of categorical variables could be done with this code
#data
datf <- data.frame(indv=factor(paste("ID", 1:20),
levels =rev(paste("ID", 1:20))), matrix(sample(LETTERS[1:7], 400, T), ncol = 20))
library(ggplot2);
library(reshape2)
# converting data to long form for ggplot2 use
datf1 <- melt(datf, id.var = 'indv')
ggplot(datf1, aes(variable, indv)) + geom_tile(aes(fill = value),
colour = "white") + scale_fill_manual(values= rainbow (7))
The codes came from here: http://rgraphgallery.blogspot.com/2013/04/rg54-heatmap-plot-of-categorical.html
But what about multiple categories in a single cell like this? Is it possible to use triangle or other shape as a cell?
http://postimg.org/image/4dudrv0nz/

• 9,356 views
•
link
1 answer
Take a look at geom_polygon.
• 0 views
•
link
• 0 views
•
link
Your question is probably more likely to get a useful answer on Stack Overflow. I think the ggplot2 developer hangs out there.
• 0 views
•
link
Log in to answer this question.
It interesting task does anybody figure out how to do it ????