1

This is my data

df<- structure(list(name = structure(c(2L, 12L, 1L, 16L, 14L, 10L, 
9L, 5L, 15L, 4L, 8L, 13L, 7L, 6L, 3L, 11L), .Label = c("All", 
"Bab", "boro", "bra", "charli", "delta", "few", "hora", "Howe", 
"ist", "kind", "Kiss", "myr", "No", "TT", "where"), class = "factor"), 
    value = c(1.251, -1.018, -1.074, -1.137, 1.018, 1.293, 1.022, 
    -1.008, 1.022, 1.252, -1.005, 1.694, -1.068, 1.396, 1.646, 
    1.016)), .Names = c("name", "value"), class = "data.frame", row.names = c(NA, 
-16L))

I checked all previous answer but I am stuck, I really don't know if even it is possible to do which might be very simple so I already apologies if it is not a proper question. if you just give me a hint I will do that myself

nik
  • 2,500
  • 5
  • 21
  • 48

1 Answers1

6

Since heatmaps are just a variation of tile-plots, you can try that:

library(ggplot2)

ggplot(df, aes(x = name,y = 1, fill = value)) + 
  geom_tile() + 
  ylab("") 

enter image description here

Deena
  • 5,925
  • 6
  • 34
  • 40
  • that is very nice! thanks I have one more question because my real data is huge and my x label go together, it is possible to plot it vertically, and also the x names 90 degree rotate so that they don't mess up? – nik Aug 11 '16 at 07:33
  • To plot it vertically, just switch the mappings of x & y (ie: `aes(x = 1,y = name, fill = value)`) – Deena Aug 11 '16 at 07:36
  • I liked and accept your answer. however, the last question is there a way to do it like cluster analysis ? http://stackoverflow.com/questions/17924828/differences-in-heatmap-clustering-defaults-in-r-heatplot-versus-heatmap-2 – nik Aug 11 '16 at 07:43