A pie chart is a circular
statistical graphic, which is divided into slices to illustrate numerical
proportion. In a pie chart, the arc length of each slice is proportional to the
quantity it represents. Pie charts are widely used to show percentage or
proportional data and usually the total sum of all segments needs to equal
100%.
There are several R functions
that can be used to create a pie chart, some of the most popular ones are:
- pie() : This is a basic function in R to
create a pie chart. It takes in a numeric vector of values as input and creates
a pie chart with each element of the vector representing the proportion of
the corresponding slice.
pie(x, labels, radius, main, col, clockwise)
Following is the
description of the parameters used −
- x is a vector containing the numeric
values used in the pie chart.
- labels is used to give description to the
slices.
- radius indicates the radius of the circle
of the pie chart.(value between −1 and +1).
- main indicates the title of the chart.
- col indicates the color palette.
- clockwise is a logical value indicating
if the slices are drawn clockwise or anti clockwise.
- pie3D() : This function creates a 3D pie chart. It takes in the same input as the pie() function, but also allows for additional customization options such as colors, labels, and explode value.
You can use any of the above
functions to create a pie chart in R, depending on your specific needs and the
level of customization you require.
0 Comments:
Post a Comment