nik nik - 1 year ago 128
R Question

how to make a heatmap with one value column

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,

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

Dee Dee
Answer Source

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


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

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download