How can I make the number appear on my graph selectively

Hi, I am a student in Korea studying R. Now I'm trying to use ggplot2, but had some problems
I made a plot like this by COVID19 dataset by time

brks = time$date # break by single day

g = ggplot(time, aes(x=date))
g = g + geom_line(aes(y=test), col = "orange")
g = g + labs(title = "COVID19 time series")
g = g + scale_x_date(breaks = brks)
g = g + geom_line(aes(y=confirmed), col = "red")
g = g + geom_line(aes(y=negative), col = "green")
g = g + geom_line(aes(y=deceased), col = "black")
g = g + theme(axis.text.x = element_text(angle = 90, vjust = .5, size = 8), panel.grid.minor = element_blank())
gg = g + geom_text(aes(y=test, label = test), col = "black") +
  geom_text(aes(y=deceased, label = deceased), col = "black")


Here are my questions

  1. I want to show the numbers on my graph only the latest number, 234998.
  2. Is it possible that delete "year" in the x-axis remaining "month" and "day"?
  3. As far as I know, the legend in ggplot automatically appears when we set the color as a specific variable in a dataset. Then, how can I make it manually? If I'm wrong about the legend, then, how can I make appear my legend on my graph?

I just asked a similar question earlier this week.

Hope this helps.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.