I am trying to create a nicely formatted 2-state relief diagram in GGPlot2
In the following graph, I would like to reduce the size of the “white space” between the y axis and the value of the first factor “old” and increase the size of the space to the right of the second value “new”. In real data, my text is full sentences, so currently only First part.

My code is:
old <- data.frame(Group = "old", Rank = 1:5, Text = c("Text1","Text2","Text3","Text4","Text5"))
new <- data.frame(Group = "new", Rank = c(4,2,1,5,3), Text = c("Text1","Text2","Text3","Text4","Text5"))
df <- rbind(old,new)
library(ggplot2)
ggplot(df, aes(x=Group, y= Rank, group = Text, label = Text)) +
geom_line() +
scale_y_reverse() +
geom_text(data = subset(df, Group == "new"), size=3, hjust=0)
source
share