R language Access Menu

Title Text Both  

Angled x-axis labels

If x-axis labels are long, it may be needed to make them printed at an angle so that they do not overlap each other. This can be done with following function: 


> mygg_anglex=function (sent_angle=45, sent_col='black'){
    theme(axis.text.x=element_text(colour=sent_col,angle=sent_angle, size=10, hjust=1, vjust=1))

> mtcars$model = rownames(mtcars)
> ggplot(mtcars, aes(model, mpg))+ geom_bar(stat='identity')+ mygg_anglex()

output (graph): 


    Comments & Feedback