Here are two plots I intend to combine:
First is half matrix of heatmap plot. ..............................
# plot 1 , heatmap plot
set.seed (123)
myd <- data.frame ( matrix(sample (c(1, 0, -1), 500, replace = "T"), 50))
mmat <- cor(myd)
diag(mmat) <- NA
mmat[upper.tri (mmat)] <- NA
heatmap (mmat, keep.dendro = F, Rowv = NA, Colv = NA)
I need to suppress the names in x and y columns and put them in diagonal.
The second plot, please note that names / labels in first plot corresponds name in second plot (x1 to X10):
vard <- data.frame ( position = c(1, 10, 15, 18, 20, 23, 24, 30, 35, 40),
Names =paste ("X", 1:10, sep = ""))
plot(vard$position, vard$position - vard$position,
type = "n", axes = FALSE, xlab = "", ylab = NULL, yaxt = "n")
polygon(c(0, max(vard$position + 0.08 * max(vard$position)),
max(vard$position) + 0.08 * max(vard$position),
0), 0.2 * c(-0.3, -0.3, 0.3, 0.3), col = "green4")
segments(vard$position, -0.3, vard$position, 0.3)
text(vard$position, 0.7, vard$position,
srt = 90)
text(vard$position, -0.7, vard$Names)
I intend rotate the first plot so that X1 to X10 should correspond to the same in the second plot and there is connection between labels in second plot to first plot. The output would look like:
How can I do this ?
Edits: based on comments about add = TRUE....I am trying to add polygon to the heatmap plot, the like follows. But I could not find coordinates ..The strategy plot this way and flip the actual figure later...help much appreciated...
See Question&Answers more detail:
os