R - Pie Charts

Last Updated : 16 Jun, 2025

A pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportions. It depicts a special chart that uses "pie slices", where each sector shows the relative sizes of data. A circular chart cuts in the form of radius into segments describing relative frequencies or magnitude also known as a circle graph. R Programming Language uses the function pie() to create pie charts. It takes positive numbers as a vector input. 

Syntax

pie(x, labels, radius, main, col, clockwise)

Parameters: 

  • x: A vector of numeric values for the pie chart.
  • labels: Descriptions for the pie chart slices.
  • radius: Defines the radius of the pie chart (value between -1 and +1).
  • main: Title of the pie chart.
  • clockwise: Logical value determining if slices are drawn clockwise or anticlockwise.
  • col: Colors for the pie chart slices.

1. Creating a simple pie chart

To create a simple R pie chart we can use the above parameters. It can be described by giving simple labels.

Example: 

R
geeks<- c(23, 56, 20, 63)
labels <- c("Mumbai", "Pune", "Chennai", "Bangalore")

pie(geeks, labels)

Output:

R - Pie ChartsGeeksforgeeks
R - Pie Charts

1.1 Pie chart including the title and colors

To create a color and title pie chart. 

  • Take all parameters which are required to make a R pie chart by giving a title to the chart and adding labels.
  • We can add more features by adding more parameters with more colors to the points.

Example: 

R
geeks<- c(23, 56, 20,