June 2016
Beginner to intermediate
1783 pages
71h 22m
English
In this recipe, we will learn how to adjust the styling of bars by setting their width, the space between them, colors, and borders.
We will continue using the citysales.csv example dataset in this recipe. Make sure that you have loaded it into R and type in the recipe at the R prompt. You might also want to save the recipe as a script so that you can easily run it again later.
Let's adjust all the arguments at once to make the same graph as in the Creating bar charts with more than one factor variable recipe but with different visual settings:
barplot(as.matrix(citysales[,2:4]), beside=TRUE, legend.text=citysales$City, args.legend=list(bty="n",horiz=T), col=c("#E5562A","#491A5B","#8C6CA8","#BD1B8A","#7CB6E4"), ...Read now
Unlock full access