Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

209_uniform_color_barplot

 

 

 

Graph #208 presents what is a barplot and how to compute one using R. Graph #209 shows the basic options of the barplot function. This page explains how to custom the layout of the chart: modifying the x and y axis. Let’s recall a basic barplot:

 

 


 

210_change_labels_orientation_barplot

 

 

 
The las argument allows to change the orientation of the labels of axis. You can choose: 0: always parallel to the axis / 1: always horizontal / 2: always perpendicular to the axis / 3: always vertical. This is really helpful for horizontal bar chart.


210_change_labels_names_barplot

 

 

 

Then, change the group names if needed using the names.arg argument. The vector you give must be the same length than the number of reads.


Custom the labels using the font.axis, col.axis and cex.axis to change font, color and size respectively. To custom the axis name, use font.lab, col.lab and cex.lab. Concerning font, remember the choices: 1: normal font, 2: bold, 3: italic, 4: bold italic


210_increase_margin_to_fit_axis_labels_barplot

 

 

 
If your group names are long, you can not let them horizontaly or they will overlap. If you put them verticaly using the las option, you need to increase the margin first or the labels will get out the chart limits. Do it using the mar argument as follow:

 


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


Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz