How can I add on the graph legend an NA or "0" label if I used trans="log"
in the scale_fill_viridis
or another continuous scale
> d1
persona num.de.puntos puntos
1 p1 1 3
2 p1 2 4
3 p1 3 0
4 p1 4 4
5 p1 5 2
6 p2 1 2
7 p2 2 3
8 p2 3 0
9 p2 4 0
10 p2 5 4
11 p3 1 0
12 p3 2 1
13 p3 3 0
14 p3 4 5
15 p3 5 8
p <- ggplot(d1, aes(persona, num.de.puntos, fill = puntos)) +
scale_fill_viridis(trans="log", option ="D", direction=1, na.value = "gray50",
breaks=c(0,1,5,8),
name="Number of people",
guide=guide_legend(label.position = "bottom",
title.position = 'top',
nrow=1,
label.theme = element_text(size = 6,
face = "bold",
color = "black"),
title.theme = element_text(size = 6,
face = "bold",
color = "black"))) +
geom_tile(colour="grey", show.legend = TRUE)
p
I want