2

So I was plotting this code, but the text is overlapping. How can I fix this? enter image description here

mayors <- read.csv("https://raw.githubusercontent.com/umbertomig/intro-prob-stat-FGV/master/datasets/brmayors.csv")
head(mayors)

mosaicplot(table(mayors$SIGLA_PARTIDO, mayors$DESCRICAO_SEXO), main = "Gender by party", color = "turquoise")

mosaicplot(table(mayors$SIGLA_PARTIDO, mayors$DESCRICAO_GRAU_INSTRUCAO), main = "Level of education by party", color = "plum")

enter image description here

Ian Campbell
  • 23,484
  • 14
  • 36
  • 57
hello
  • 23
  • 2

1 Answers1

2

You can control the direction of the axis labels with las =. You can also control the size of the text with cex.axis =.

mosaicplot(table(mayors$SIGLA_PARTIDO, mayors$DESCRICAO_GRAU_INSTRUCAO),
           main = "Level of education by party",
           color = "plum",
           las = 2,
           cex.axis = 0.5)

enter image description here

Ian Campbell
  • 23,484
  • 14
  • 36
  • 57