A colored 2D matrix plot was created using the following codes:
library(plotrix)
testdf = data.frame(c(0,1,1),c(1,1,2),c(1,2,2))
color2D.matplot(testdf,
show.values = FALSE,
axes = FALSE,
xlab = "",
ylab = "",
vcex = 2,
vcol = "black",
extremes = c("red", "yellow", "green"))
However, this function can only show the numerical values within each cell, but what I want is some pre-specified texts (which can be provided from another data frame) added in each cell, like the screenshot below:
Is there a way in plotrix
or some other R packages (e.g. ggplot2
) that can make it? Thanks.