Home > Net >  Change font size of each column in simple bar plot so that all labels are visible?
Change font size of each column in simple bar plot so that all labels are visible?

Time:04-08

editing out the question to remove now that it's been answered

CodePudding user response:

An option would be rotation the labels of your x-axis using las = 2. I created some extra random labels to give you a reproducible example. First a before plot:

df <- data.frame(Department_lower=sample(c('labelA', 'entrees', 'salad', 'labelB', 'general', 'catering', 'swag', 'labelC', 'labelD'),
                                   50, replace=TRUE))

plot <- barplot(sort(table(df$Department_lower), decreasing=TRUE)) 

Before:

enter image description here

Rotating x-axis labels:

plot <- barplot(sort(table(df$Department_lower), decreasing=TRUE), las = 2)

Output:

enter image description here

  • Related