Change font size of likert plot legend and value label arrangement

2.4k views Asked by At

The default font size of the likert plot of the HH package is small and I want to increase its size for reading. I also want to control the order of the labeling value of the legend.

To get my value labels to be ordered correctly I have had to recode my data as "1 Not Valuable", "2 Neutral", and "3 Valuable". I do not want to have the "1", "2", and "3" listed, and simply want it listed as "Not Valuable", "Neutral", and "Valuable", however, when I try and list the values as categorical variables, the value defaults to alphabetical order (e.g., "Neutral", "Not Valuable", "Valuable"). I want the values to be in the order "Not Valuable", "Neutral", "Valuable".

Here is my current code and data (a)

          Value
Age        1 Not Valuable 2 Neutral 3 Valuable
  18-25                 8         4          8
  25.01-35             17        12         22
  35.01-45             10        19         18
  45.01-55             11        15         22
  55.01-65             27        25         34
  65.01-93             37        40         30

age=likert(a, ylab='Age Category', main='AGE DISTRIBUTION', 
    as.percent=TRUE,  col=c('gray70', 'gray48', 'black'))

I have also tried using the "theme" function to control text size with the code:

+theme(legend.text=element_text(size=12))

However, I get the R error that states

could not find function theme

I have not found any information on controlling the order of value scale in the legend.

2

There are 2 answers

1
user3288073 On BEST ANSWER

I had the same issue and had to use a command from the lattice package. Add this to your code:

auto.key.in = list(cex = 1.2)

adjusting the number to the font size you desire.

0
Julien Colomb On

check ?likert.plot :

you can then use

plot (age, legend.position="right", group.order = a$Age)