nik
nik

Reputation: 2584

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, 
-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

Upvotes: 3

Views: 3426

Answers (1)

Deena
Deena

Reputation: 6223

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

Upvotes: 9

Related Questions