1

I am trying to rotate labels (not variable names) for a plot I have created, and I am struggling to find and adopt any workable solution. As you can see the labels are not readable I the current form.

Plot is looking into reasons for planning permission objections, and variables are Income, politics, Sex, and Attitude to new homes in their region.

Here is the code. Last iteration, includes labeling function, but does not have any effect on the plot.

library(vcd)
mosaic(~Sex+HomsBultBPV+HHIncQV++PartyID, data=BSA, shade=TRUE, 
       labeling_args = list(set_varnames = c(Sex="Gender", HomsBultBPV="Attitude To Homes Built in Area", 
                            PartyID="Political Affiliation", HHIncQV="Income Quartile", 
                            labeling= labeling_border(rot_labels = c(25,25,25,0), 
                                                      just_labels = c("left", 
                                                                      "center", 
                                                                      "center", 
                                                                      "center")))))
Chaitanya Gadkari
  • 2,669
  • 4
  • 30
  • 54

1 Answers1

1

The solution is this parameter: "vcd::labeling_border(rot_labels = c(__, __))"

Try out this code:

library(vcd)
mosaic(~ Sex + Age + Survived, data = Titanic,
       main = "Survival on the Titanic", shade = TRUE, legend = TRUE,
       labeling = vcd::labeling_border(rot_labels = c(45, 45)))
Luker
  • 141
  • 2
  • 4