O'Reilly logo

R Data Visualization Cookbook by Atmajitsinh Gohil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Constructing a fan plot

Fan plots are very similar to pie charts; the different sectors/slices in a fan plot overlap. The slice with the highest value is placed at the back and subsequent slices are plotted on top of it. In our example, Army has the highest percentage, followed by Marines, Air Force, and Navy. Note that Air Force and Navy overlap each other as the values are very close.

Constructing a fan plot

Getting ready

To construct a fan plot, we use the following two packages:

  • plotrix
  • RColorBrewer

How to do it…

The fan plot is implemented using the plotrix package; hence we need to install and load this in our R session. We have used the colors from RColorBrewer and hence ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required