I am trying to label the tiles in geom_tile with the Greek symbol, kappa, as follows
kappa = value
I've tried using expression() and bquote() but cannot find a way to make it work
df = data.frame(x = letters[1:10],y = letters[11:20], value = 1:10)
p = ggplot(df, aes(x = x, y = y)) +
geom_tile()+geom_text(aes(label= paste("k = ",value,"")), color = "white")
p
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/5bDLv.png
use parse = TRUE
also learn more about mathematical expressions used in plot by following this: ?plotmath
ggplot(df, aes(x = x, y = y)) +
geom_tile() +
geom_text(mapping = aes(label = paste('kappa', "==", value)), parse = TRUE, color = "white")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With