Ciao guys,
I have the following dataframe
obj <- data.frame (percentile = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6 , 0.7, 0.8, 0.9, 1),
emp_change = c(0.05, 0.04, 0.03, 0.05, 0.06, 0.04, 0.02, 0.09, 0.08, 0.06),
task = c("Manual", "Manual", "Manual", "Routine-Manual", "Routine-Manual",
"Routine-Abstract", "Routine-Abstract", "Abstract", "Abstract", "Abstract"))
My goal is to display the variable task
on my x axis as well. I don't know if it would be necessary to generate a second x axis.
I know that the question is pretty straightforward and was definitely asked before but I fail as I only found solutions for barplots.
This is my plot. Note also, that I use in my real data geom_smooth rather than geom_line. But I guess this should be irrespective when creating a second x axis.
plot <- ggplot() +
geom_line(data = obj, aes(x= percentile, y= emp_change, group = 1, color="observed", linetype = "observed"),
size=1.5, linetype = "dotdash")
print(plot + theme(axis.text.x=element_text(angle = 60, hjust = 1)) +
theme(axis.title=element_text(size=12)) +
labs(y="100 x Change in Employment Share", x = "Percentile ranked by task input and log of mean occupational wage (1990)"))
Many thanks in advance
Freddy