A circular barplot is a barplot where bars are displayed along a circle instead of a line. This page aims to teach you how to make a circular barplot with groups. Since this kind of chart is a bit tricky, I strongly advise to understand graph #295 and #296 that will teach you the basis.

 

The first step is to realise this circular plot with a break in the circle. Actually, I just added a few empty lines at the end of the initial data frame.

 

 

 

This concept can now be used to add space between each group of the dataset. I add n lines with only NA at the bottom of each group.

This chart is far more insightful since it allows one to quickly compare the different groups, and to compare the value of items within each group.

The right-hand chart is exactly the same one, but with observations sorted by bar height within each group. It can be useful if your goal is to understand what are the highest / lowest observations within and across groups.

 

To order the data, just add this code right after the data frame creation:

Last but not least, it is highly advisable to add some customisation to your chart. Here we add group names (A, B, C and D), and we add a scale to help compare the sizes of the bars. Voila! The code is a bit long, but the result is quite worth it in my opinion!

 

 

Related


 

Make a search


 

 


9
Leave a Reply

avatar
4 Comment threads
5 Thread replies
3 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
BarbZasiHoltzThadeu MeloLuca Zavarella Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Barb
Guest
Barb

Nice plot! If I have two grouping variables (say, shape and texture of objects) and would like to fill the bars according to shape (round = blue, square = green etc) and have the bar outline according to texture (soft = yellow, hard = red etc)., how would I do that?
Thank you!

Zasi
Guest
Zasi

The last plot gives me the following error:

Error: Aesthetics must be either length 1 or the same as the data (1): x, y, xend, yend

Any solution to fix this? Thanks.

Thadeu Melo
Guest
Thadeu Melo

Hi! I could not use the function:

# Order data:
data = data %>% arrange(group, value)

The response is:

> data=data %>% arrange(group)
Error in data %>% arrange(group) : could not find function “%>%”

What is the possible reason?

Luca Zavarella
Guest

Very nice plot! Just an hint to use a custom data frame: the values have to be rescaled to 0-100.