0

I am trying to create a barplot but the labels overlap due to the length of the string. I tried shortening the names of the strings but that changes the underlying order. When I manually try to set the order using levels I get a bunch of NA.

  ggplot(income_educa_copy, aes(x = factor(X_educag), fill = X_incomg))+ 
  geom_bar(position = position_fill(reverse = TRUE)) +
  ggtitle("Educational Achievement of Respondents") +
  scale_fill_brewer("Income \nLevel",palette="Green",direction=-1) +
  xlab("Educational Achievement") + 
  ylab("Proportion")

Below is the link of the image of the graph. Bar Plot Image

joypoddar
  • 1
  • 2

1 Answers1

0
  ggplot(income_educa_copy, aes(x = factor(X_educag), fill = X_incomg))+ 
  geom_bar(position = position_fill(reverse = TRUE)) +
  ggtitle("Educational Achievement of Respondents") +
  scale_fill_brewer("Income \nLevel",palette="Green",direction=-1) +
  xlab("Educational Achievement") + 
  ylab("Proportion") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
PejoPhylo
  • 469
  • 2
  • 11