I am trying to add the label of a number above geom_point
using geom_text
with no success. I want to show the calories intake of each fruit. It is clear on the x-axis, but i would like to write the label of each number above the dot point in the plot. Could someone help please?
Here is the data and the code:
df= structure(list(fruit = structure(1:3, .Label = c("Orange", "Banana",
"Kiwi"), class = "factor"), term = c("calories", "calories", "calories"),
calories = c(47, 89, 61
)), row.names = c(NA, -3L), class = "data.frame")
df %>%
ggplot(aes(calories, fruit)) +
geom_point(mapping=aes(x=calories, y=fruit), size=5)