0

So I have a plot which has taken me ages to produce. It needs to specify month and be both a line and point like this:

enter image description here

However I get this error message and 'September' doesn't appear as a point.

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

This is the code for my plot:

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))

The data looks like this: enter image description here

I don't currently have the data in a code format but can do this if needed. I have tried expanding the y axis but no luck. I am unsure how to deal with this error, whilst keeping the months as words and not numeric.

Any help would be appreciated :)

Dave2e
  • 22,192
  • 18
  • 42
  • 50
  • 2
    Hello Steph, weolcome! It is difficult to help you with an image of the dataset. Please run dput(Rate_time) to get us a reproducible example. – Nicolás Velasquez Mar 09 '21 at 21:21

1 Answers1

0

R is not recognizing "Sept" as September. Try using "Sep" instead.

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))
Dave2e
  • 22,192
  • 18
  • 42
  • 50