2

here is a reprex

library(ggplot2)
library(reshape2)
dat <- iris[,1:4]
cor <- melt(cor(dat, use="p"))
head(cor)
heat <- ggplot(data=cor, aes(x=Var1, y=Var2, fill=value)) 
heat + geom_tile() + labs(x = "", y = "") + scale_fill_gradient2(limits=c(-1, 1))

enter image description here

how can I make the color bar height match and align with the y-axis?

many thanks!

Myriad
  • 341
  • 1
  • 8
  • 1
    very interesting question. I think I might put a bounty on the linked duplicate - keep your eyes peeled. – tjebo Dec 29 '22 at 18:05
  • Myriad - I have added a solution to this question in my answer to the linked duplicate as an example. – Allan Cameron Dec 30 '22 at 15:12
  • thank you both, I will delete this question now – Myriad Dec 30 '22 at 19:11
  • Myriad, please don't delete this question!! Duplicates are good! They help people finding good answers - it increases the searchability and visibility of relevant threads. And you have asked a very good question! – tjebo Jan 02 '23 at 10:43
  • 1
    Ahh sounds good..thanks @tjebo will keep it – Myriad Jan 02 '23 at 14:47

0 Answers0