I would like to add a text description between my countries on the x-axis to differentiate between them. This description would be 1) "Europe" between (France and Italy) and 2) North America between (US and Canada). If it is possible i would like to add some short straight lines so the reader can see how the groups are divided (i provide another plot example below of what i am aiming for). I tried to get around the problem using geom_text
in different ways but i did not succeed. Could someone help please?
Here is my plot:
Here is the data and the code:
df= structure(list(country = structure(1:4, .Label = c("France", "Italy",
"US", "Canada"), class = "factor"), term = c("unemp", "unemp", "unemp","unemp"),
unemployment = c(10, 11.6, 6.3, 6.5
)), row.names = c(NA, -4L), class = "data.frame")
df %>%
ggplot(aes(unemployment, country)) +
geom_point(mapping=aes(x=unemployment, y=country)) +
coord_flip()
Below you find a good example of what i am trying to achieve for my simple plot. There are three groups and there is a text below the names of the countries and some short straight lines on the side to differentiate between the groups.