If you read graph #208 you now know what is a barplot and how to compute one using R. This section describes the options you can apply to the barplot function to custom it. Let’s start with the most basic barplot you can, without giving any option:

Let’s study how to custom colors of the barplot. There are 2 possibilities: applying the same color to every bar (giving one color only), or specifying the color of each bar (giving a vector of color). If vector length is less than number of bars, the color values will be repeated.




Then, it is always important to add classic features, like a title to the chart and to the axis, and specific limit for the axis.




It is really easy to make the barplot horizontal instead of vertical. Use the option las=1 to make the axis labels in the good orientation.

It is possible to control the space between bars and the width of the bars. Can be usefull  to represent the number of values behind each bar.

Not what you are looking for ? Make a new search !


Leave a Reply

Notify of