I have a table barplot (basic table with counts of each level for a factor) where the category names along the x axis are longer than I would like them to be. This is true even after making them perpendicular and adjusting the margins.
How can I shorten either these labels or each catagory name in the table to be only the first n characters?
Example:
How would make the labels for: barplot(table(factor(c("azzzz", "bzzzz", "bzzzz", "czzzz")))) be a,b, and c.
Just take substrings of the vector you are passing to
table:EDIT
Now that I think about it, you probably need the full strings for
tableto match them up correctly. In which case maybe split it into separate steps:You can also pass them directly into
barplot: