title: Eliminate the diagonal values in a correlation plot
body: <p>I am trying to analyze the correlation between various factors using ggplot, how do i get rid of the diagonal values that have a correlation value 1. </p>
  
  <p>Here's the code </p>
  
  <pre><code>data(attitude)
  library(ggplot2)
  library(reshape2)
  
  M = cor(attitude,use="pairwise.complete.obs")
  M = round(M,4)
  M[lower.tri(M)] &lt;- NA
  
  dat2 &lt;- melt(M, id.var = rownames(M)[1])
  ggplot(dat2, aes(as.factor(Var1), Var2, group=Var2)) + geom_tile(aes(fill = value)) + 
  geom_text(aes(fill = dat2$value, label = round(dat2$value, 1))) +
  scale_fill_gradient(low = "yellow", high = "#D6604D", space = "Lab", 
  na.value = "grey50")
  </code></pre>
  
  <p>Here's the plot and my goal is to get rid of the diagonal values.</p>
  
  <p><img src="https://i.stack.imgur.com/AoxgC.png" alt="enter image description here"></p>