Data Construction
df <- tibble(
date = c(
'2000-01-01','2000-02-01','2000-03-01','2000-04-01','2000-05-01'
,'2000-06-01','2000-07-01','2000-08-01','2000-09-01','2000-10-01'
,'2000-11-01','2000-12-01'
)
, Received = c( 160, 184, 241, 149, 180, 161, 132, 202, 160, 139, 149, 177 )
, Processed = c( 160, 184, 237, 148, 181, 150, 123, 156, 126, 104, 124, 140 )
) %>%
reshape2::melt(id.vars = 'date') %>%
mutate(
date = as.Date(date, '%Y-%m-%d')
)
Plot Construction
# Base Plot
ggplot(df, aes(x = month(date), y = value, color = variable))+
geom_line()+geom_point()

# Change Size, Color and Themes
ggplot(df, aes(x = date, y = value, color = variable))+
geom_line(size = 1.5)+
geom_point(size = 4)+
scale_color_manual(values=c("Received" = "#898989", "Processed" = "#1f477c"), guide = NULL)+
theme_classic()+
theme(
axis.line = element_line(color = "#BFBEBE"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.ticks = element_line(color = "#BFBEBE"),
axis.text = element_text(color = "#A6A6A5", size = 12),
plot.margin = unit(c(1, 4, 1, 1), "cm")
)

# Fix x-axis
ggplot(df, aes(x = date, y = value, color = variable))+
geom_line(size = 1.5)+
geom_point(size = 4)+
scale_x_date(date_breaks="1 month", date_labels="%b")+
scale_color_manual(values=c("Received" = "#898989", "Processed" = "#1f477c"), guide = NULL)+
geom_text(
data = df %>% filter(variable == 'Received')
, aes(label=value)
, nudge_y = 10, size = 4
)+
geom_text(
data = df %>% filter(variable != 'Received')
, aes(label=value)
, nudge_y = -10, size = 4
)+
xlab('')+ylab('')+
coord_cartesian(clip = "off")+
theme(
axis.line = element_line(color = "#BFBEBE"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.ticks = element_line(color = "#BFBEBE"),
axis.text = element_text(color = "#A6A6A5", size = 12)
)+theme_classic()

# Add Text
# Only for August or higher
ggplot(df, aes(x = date, y = value, color = variable))+
geom_line(size = 1.5)+
geom_point(size = 4)+
scale_x_date(date_breaks="1 month", date_labels="%b")+
scale_color_manual(values=c("Received" = "#898989", "Processed" = "#1f477c"), guide = NULL)+
geom_text(
data = df %>% filter(variable == 'Received') %>% filter(month(date) >= 8)
, aes(label=value)
, nudge_y = 10, size = 4
)+
geom_text(
data = df %>% filter(variable != 'Received') %>% filter(month(date) >= 8)
, aes(label=value)
, nudge_y = -10, size = 4
)+
annotate(
"text"
, x = as.Date('2000-12-30', '%Y-%m-%d')
, y = 177, label = "Received"
, size = 4, color = '#898989'
)+
annotate(
"text"
, x = as.Date('2000-12-30', '%Y-%m-%d')
, y = 140, label = "Processed"
, size = 4, color = '#1f477c'
)+
xlab('')+ylab('')+
coord_cartesian(clip = "off")+
theme(
axis.line = element_line(color = "#BFBEBE"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.ticks = element_line(color = "#BFBEBE"),
axis.text = element_text(color = "#A6A6A5", size = 12)
)+theme_classic()
