geom_point() 中的缺失值

Missing values in geom_point()

所以我有一个情节,我花了很长时间才制作出来。它需要指定月份并且既是线又是点,如下所示:

但是我收到此错误消息并且 'September' 没有显示为一个点。

Warning messages: 1: Removed 1 rows containing missing values (geom_path). 2: Removed 1 rows containing missing values (geom_point).

这是我的剧情代码:

ggplot(Rate_time, aes (x=Month, y = Rate)) + 
  geom_line(aes(group=1), colour = "Orange") + 
  geom_point(colour = "Orange") + 
  theme_classic() + 
  scale_x_discrete(limits = month.abb) + 
  labs (y = "Rate (%)", x = "Month (2019)") + 
  theme(axis.text.x = element_text(colour = "black")) + 
  theme(axis.text.y = element_text(colour = "black")) + 
  theme(text=element_text(size=11,family="serif")) + 
  scale_y_continuous(limits=c(0,0.25))

数据如下所示:

我目前没有代码格式的数据,但如果需要可以这样做。我试过扩大 y 轴但没有成功。我不确定如何处理此错误,同时将月份保留为单词而不是数字。

任何帮助将不胜感激:)

R 无法将“Sept”识别为 September。请尝试改用“Sep”。

set.seed(123)
#Works as is
Rate_time<- data.frame(Month=month.abb, Rate=runif(12, 0, 0.25))


#add this line to reproduce your problem.
#changes Sep to Sept
#Rate_time$Month[9] <- "Sept"

ggplot(Rate_time, aes (x=Month, y = Rate)) + 
   geom_line(aes(group=1), colour = "Orange") + 
   geom_point(colour = "Orange") + 
   theme_classic() + 
   scale_x_discrete(limits = month.abb) + 
   labs (y = "Rate (%)", x = "Month (2019)") + 
   theme(axis.text.x = element_text(colour = "black")) + 
   theme(axis.text.y = element_text(colour = "black")) + 
   theme(text=element_text(size=11,family="serif")) + 
   scale_y_continuous(limits=c(0,0.25))