I have CSV data where I have two columns and I need to plot Time as x axis and count as y axis. The time in the data ranges from 2008 Sep to 2021 Dec. Data points are monthly.
This is my data in csv format.
When I plotted the data, since there are lot of points for month and year, I am not able to see the labels in the x axis.
I want to put 5 certain time points in the x axis like below:
This is what I tried:
library(ggplot2)
theme_set(
theme_bw(),
theme(legend.position = "top")
)
result <- read.csv("Downloads/Questions Trend - Questions Trend.csv")
p <- ggplot(result, aes(result$Time_Formatted, result$VCS_Feature_History_Sanitize_Trnd)) +
geom_point(size = 0.1) + xlab("Month") + ylab("Temporal Trend")
p + geom_smooth(method = "loess", color = "red")
I tried below and could remove some points but still can not customize to specific points.
library(ggplot2)
library(scales)
theme_set(
theme_bw(),
theme(legend.position = "top")
)
result <- read.csv("Downloads/Questions Trend - Questions Trend.csv")
result$Time_Formatted <- as.Date(result$Time_Formatted)
p <- ggplot(result, aes(result$Time_Formatted, result$VCS_Feature_History_Sanitize_Trnd)) +
geom_point(size = 0.1) + xlab("Month") + ylab("Temporal Trend") +
scale_x_date(date_breaks = "years" , date_labels = "%b-%y")
p + geom_smooth(method = "loess", color = "red")
How to give specific points in the x axis?