Rotate Axis Labels in R - HH Package
Rotate Axis Labels in R - HH Package
Any suggestions on rotating the axis labels in a plot from the HH package in R?
In the example below, I would like the labels A, B, and C to be at a 45-degree angle. 'rot' only rotates the ticks, and text(object, srt=45) doesn't seem to work.
library(HH)
test<-data.frame('A'=c(10,12,40,12),
'B'=c(14,23,13,30),
'C'=c(11,40,12,16))
rownames(test)<-c("No","Maybe","Plausible","Yes")
likert(t(test)[,1:4], horizontal = FALSE,as.percent = TRUE,
main = NULL,
xlab = "Percent", # becomes ylab due to horizontal arg
ylab = "Condition", #xlab.top = "Total in Condition",
ylab.right = FALSE #removes Row Count Totals from Right)
1 Answer
1
Here is an approach:
likert(t(test)[,1:4], horizontal = FALSE,as.percent = TRUE,
main = NULL,
xlab = "Percent", # becomes ylab due to horizontal arg
ylab = "Condition", #xlab.top = "Total in Condition",
ylab.right = FALSE,
scales = list(x = list(rot = c(45, 0))))
This is the same as with other lattice graphs. A two element vector is provided for the rotation of bottom and upper labels.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.