r - How to maximize the width of ggplot bar chart? -
assume have used ggplot works quit well. code below:
female<-subset(fl_estonia,sex=="f" ) roles<-ggplot(female,aes(role,fill=role))+ geom_bar(col=rainbow(length(table(female$role)))) roles+theme(axis.text.x = element_text(angle = 90,hjust=1),legend.position="none") the output such below picture:
point is, plot bit condense, i use empty space on right handside of image?
you can example increase width (width = ...) and/or space between bars (position_dodge(width = ...)) in geom_bar():
...+ geom_bar(width = 1, position = position_dodge(width = 1)) + in case exactly:
female<-subset(fl_estonia,sex=="f" ) roles<-ggplot(female,aes(role,fill=role))+ geom_bar(width = 1, position = position_dodge(width = 1),col=rainbow(length(table(female$role)))) roles+theme(axis.text.x = element_text(angle = 90,hjust=1),legend.position="none") [!] solution not work in rmarkdown or shiny! have not specified in environment is, assumed wanna plot.
Comments
Post a Comment