I want to display color key on my heatmap library(gplots)

data=structure(c(-0.1152, 0.1548, 0.0037, 0, 0, 0, 0, 0, 0, 0.1369, 
0.1914, 0, 0.0499, 0, 0, 0, 0, 0.1259, 0, 0.1854, -0.4412, 0, 
-0.4425, 0, 0, -0.5141, 0, -0.3463, 0.1529, -0.1176, 0.4153, 
-0.4412, 0.2169, 0.1894, 0.3288, 0.5549, -0.2549, 0.1915, -0.0759, 
0.1255, 0.2269, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.4412, -0.1923, 
0.1502, 0, 0, 0, -0.1978, 0.0828, 0, 0.2214, 0.192, 0, -0.2651, 
0.192, -0.1412, -0.287, 0, -0.2299, 0, 0.1095, 0, 0.0166, 0, 
0.1617, -0.16, 0, 0, 0.1255, 0, 0.2298, 0.153, 0.1627, 0, 0.293, 
0.2476, -0.1565, 0.0899, 0, 0.2217, 0.2274, 0.1764, 0.1538, 0, 
0.1747, 0.1857, -0.2309, 0.0827, -0.0609, 0.0754, -0.2653, 0.1461, 
0.1611, -0.1201, 0, 0, 0.114, 0.237, 0.1738, 0, 0.2269, 0, 0.0068, 
0, 0.1288, -0.1727, -0.1187, -0.1502, -0.1502, 0, -0.4104, -0.1305, 
-0.1126, -0.2642, -0.1264, -0.2403, 0.1522, 0.0211, 0.1175, -0.0549, 
-0.2571, -0.1305, -0.2143, -0.2153, -0.0566, -0.2068, 0.0406, 
-0.087, 0.079, -0.0238), .Dim = c(10L, 14L), .Dimnames = list(
    c(&quot;AI&quot;, &quot;AUDC&quot;, &quot;AUDT&quot;, &quot;AUT&quot;, &quot;BD&quot;, &quot;CB&quot;, &quot;CD&quot;, &quot;DPW&quot;, &quot;MDD&quot;, 
    &quot;SZ&quot;), c(&quot;BI&quot;, &quot;BB&quot;, &quot;CD&quot;, &quot;CGC&quot;, &quot;CTF&quot;, &quot;HDT&quot;, &quot;MTS&quot;, &quot;NOI&quot;, 
    &quot;OFI&quot;, &quot;SRV&quot;, &quot;SAF&quot;, &quot;FFI&quot;, &quot;SUM&quot;, &quot;WIN&quot;)))

data &lt;- read.csv(&quot;C:/Users/Lenovo/Desktop/Correlation matrix VITD _Disorder_R/Z1.txt&quot;, header=TRUE, row.names=1,sep=&quot;&quot;)
data = as.matrix(data[![enter image description here][1]][1])
heatmap.2(data,
          trace =&quot;none&quot;, 
          density = &quot;none&quot;, 
          col = redblue(100),
         key=TRUE, 
         keysize=1,
          cexRow =1, 
          cexCol =1,
          margins = c(5,5),
          labCol = colnames(data),
          scale=&quot;row&quot;,
          hclust=function(x) hclust(x,method = &quot;complete&quot;))


  [1]: https://i.stack.imgur.com/jlwf4.png
I'm not sure exactly what was going on with your data, but I read it in as a raw data.frame using as.matrix(read.table(., row.names=1, header=T)). The issue was that you were reading it in without a header, so the col.names were being read in as part of the matrix. But apart from that, the rest of your command was fine:
library(gplots)

data = structure(c(-0.1152, 0.1548, 0.0037, 0, 0, 0, 0, 0, 0, 0.1369, 
0.1914, 0, 0.0499, 0, 0, 0, 0, 0.1259, 0, 0.1854, -0.4412, 0, 
-0.4425, 0, 0, -0.5141, 0, -0.3463, 0.1529, -0.1176, 0.4153, 
-0.4412, 0.2169, 0.1894, 0.3288, 0.5549, -0.2549, 0.1915, -0.0759, 
0.1255, 0.2269, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.4412, -0.1923, 
0.1502, 0, 0, 0, -0.1978, 0.0828, 0, 0.2214, 0.192, 0, -0.2651, 
0.192, -0.1412, -0.287, 0, -0.2299, 0, 0.1095, 0, 0.0166, 0, 
0.1617, -0.16, 0, 0, 0.1255, 0, 0.2298, 0.153, 0.1627, 0, 0.293, 
0.2476, -0.1565, 0.0899, 0, 0.2217, 0.2274, 0.1764, 0.1538, 0, 
0.1747, 0.1857, -0.2309, 0.0827, -0.0609, 0.0754, -0.2653, 0.1461, 
0.1611, -0.1201, 0, 0, 0.114, 0.237, 0.1738, 0, 0.2269, 0, 0.0068, 
0, 0.1288, -0.1727, -0.1187, -0.1502, -0.1502, 0, -0.4104, -0.1305, 
-0.1126, -0.2642, -0.1264, -0.2403, 0.1522, 0.0211, 0.1175, -0.0549, 
-0.2571, -0.1305, -0.2143, -0.2153, -0.0566, -0.2068, 0.0406, 
-0.087, 0.079, -0.0238), .Dim = c(10L, 14L), .Dimnames = list(
    c(&quot;AI&quot;, &quot;AUDC&quot;, &quot;AUDT&quot;, &quot;AUT&quot;, &quot;BD&quot;, &quot;CB&quot;, &quot;CD&quot;, &quot;DPW&quot;, &quot;MDD&quot;, 
    &quot;SZ&quot;), c(&quot;BI&quot;, &quot;BB&quot;, &quot;CD&quot;, &quot;CGC&quot;, &quot;CTF&quot;, &quot;HDT&quot;, &quot;MTS&quot;, &quot;NOI&quot;, 
    &quot;OFI&quot;, &quot;SRV&quot;, &quot;SAF&quot;, &quot;FFI&quot;, &quot;SUM&quot;, &quot;WIN&quot;)))


heatmap.2(data,
          trace =&quot;none&quot;, 
          density = &quot;none&quot;, 
          col = redblue(100),
         key=TRUE, 
         keysize=1,
          cexRow =1, 
          cexCol =1,
          margins = c(5,5),
          labCol = colnames(data),
          scale=&quot;row&quot;,
          hclust=function(x) hclust(x,method = &quot;complete&quot;))