rvisualizationdesctools

Label rotation in PlotCirc (DescTools package)


I am using the PlotCirc() function of the DescTools R package to visualize a contingency table:

library(DescTools)

tab <- matrix(c(2,5,8,3,10,12,5,7,15), nrow=3, byrow=FALSE)
dimnames(tab) <- list(c("ABCDEFG","BCDEFGH","CDEFGHI"), c("D","E","F"))

PlotCirc( tab,
          acol = c("dodgerblue","seagreen2","limegreen","olivedrab2","goldenrod2","tomato2"),
          rcol = SetAlpha(c("red","orange","olivedrab1"), 0.5)
)

enter image description here

Question:

How can I rotate all the labels (left and right side) so that they spread from the circle (text base line pointing to the middle of the circle) ? I.e. the first label "ABCDEFG" should be rotated by almost -90 degrees pointing upwards, whereas the "CDEFGHI" should be rotated by roughly 45 degrees pointing a bit down and so on.


Solution

  • DescTools v0.99.8 now offers a function argument las, which does exactly the job (thanks to the author Andri Signorell).