I have a line graph with the number of visitors staying at a campsite per night. My dataset ends at 10-28-2019, but my graph extends past that date which is unnecessary and provides false information. I want the graph to end at max(nightcounts$date) but am not sure where this should properly go. I tried adding it in line 1 as
aes(max(nightcounts$date), nightcounts$Freq
as an addition to the current aesthetic. Secondly, I am tryin got reformat the x- axis labeling to have the number day below each point, and then the month as a second line below thse points such as
27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
September___________October
1 base <- ggplot(data=nightcounts, aes(nightcounts$date, nightcounts$Freq)) #using ggplot with x = date, y = counts
2 base + geom_line(col="darkorchid4", aes(group = 1)) + #calling geom_line to make a line connecting data points
3 geom_point() + #calling geom_point to add points for each data point
4 labs(title = "Number of Visitors Camping per Night", #adding labels
5 x = "Date",
6 y = "Visitors") +
7 scale_x_date(labels = date_format("%m-%d-%Y"), breaks = date_breaks("week")) +
8 ggsave("Camping by Date.png") #save the image