I am trying to change (not to remove) the "a" that gets displayed by geom_label_repel in the legend. I already found the following Thread: Why does text appear in the legend? that told me how to remove it.
library(ggrepel)
data <- data.frame(xVal,yVal, stringsAsFactors = FALSE)
plot <- ggplot(data, aes(x=xVal, y=yVal)) +
geom_point() +
geom_label_repel( aes( label=pointName, fill=factor( yVal ) ), nudge_x = 1.25, nudge_y = 1.2 ) +
scale_fill_manual(values=colorPallet, labels = yVal)
This Code gives me the following image:
I want to change it so that the "a" in the legend is displaying the numbers i have in the vector pointName . (that are the numbers in the nicture that range from 48 to 96).
Thank you all.
"Guides for geom_text()
now accept custom labels with guide_legend(override.aes = list(label = "foo"))
(@brianwdavis, #2458)."
As per release 3.0.0 .
So here you'd use scale_fill_manual(values=colorPallet, labels = yVal, guide = guide_legend(override.aes = list(label = "foo")))
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.