R Tutorials
R Data Structures
R Graphics
R Statistics
R Examples
Pie chart is a circular view of the data.
Use pie()
function to draw pie charts
As you can see, the chart there pulls one pie of each value per vector (in this case 10, 20, 30, 40).
By default, the order of the first pie starts at x-axis and goes counterclockwise.
Note: The size of each pie is determined by comparing the value with all other values, using this formula:
Division divided by the sum of all values: x / sum (x)
You can change the first angle of the pie chart with the init.angle
parameter.
The init.angle
value is defined by an angle in degrees, where the default angle is 0.
Start the first pie at 90 degrees:
Use the label
parameter to add the label to the pie chart, and use the main
parameter to add a title:
You can add color to each pie with col
parameter:
To add a description list for each pie, use the legend()
function:
The myth may be as follows:
bottomright
, bottom
, bottomleft
, left
, topleft
, top
, topright
, right
, center