#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to create pie chart and 3D pie chart in R?
Description

To create pie chart and 3D pie chart for the given data using R programming.

Process

Pie Chart:

   Representation of values as slices of a circle with different colours.

   R Package : plotrix -- For 3D representation of pie chart

  R Function : pie()

  R Function : pie3D()

Sapmle Code

#Data Visualization in Pie Chart

#Read File
print(getwd())
setwd(“/home/soft13″)
print(getwd())
data<-read.csv(‘input.csv’)
print(data)

#Pie Chart
pie(data$salary,labels=data$name,main=”Pie Chart”,col=rainbow(length(data$salary)))
legend(“topright”,legend=data$name,fill=rainbow(length(data$salary)))

#Pie3D chart
#install.packages(“plotrix”)
library(“plotrix”)
pie3D(data$salary,labels=data$name,main=”Pie Chart”,col=rainbow(length(data$salary)),explode = 0.2)

Screenshots