Add pie chart color palettes

With the help of.pal function of the RColorBrewer package in R.

R




Get the library.
library(RColorBrewer)
 
# Create data for the graph.
geeks <- c(23, 56, 20, 63)
labelss <- c("Mumbai", "Pune", "Chennai", "Bangalore")
 
labels<- brewer.pal(length(geeks), "Set2")
 
pie(geeks, labels = labelss)


Output:

R – Pie Charts

 modify the line type of the borders of the plot we can make use of the lty argument:

R




Get the library.
library(RColorBrewer)
 
# Create data for the graph.
geeks <- c(23, 56, 20, 63)
labelss <- c("Mumbai", "Pune", "Chennai", "Bangalore")
 
labels<- brewer.pal(length(geeks), "Set2")
 
pie(geeks, labels = labelss, col = color, lty = 2)


Output:

R – Pie Charts

Add shading lines with the density argument. 

R




#Get the library.
library(RColorBrewer)
 
# Create data for the graph.
geeks <- c(23, 56, 20, 63)
labelss <- c("Mumbai", "Pune", "Chennai", "Bangalore")
 
labels<- brewer.pal(length(geeks), "Set2")
 
pie(geeks, labels = labelss,col = color, density = 50, angle = 45)


Output:

R – Pie Charts

R – Pie Charts

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 radii into segments describing relative frequencies or magnitude also known as a circle graph. 

Similar Reads

R – Pie Charts

R Programming Language uses the function pie() to create pie charts. It takes positive numbers as a vector input....

Add pie chart color palettes

...

3D Pie Chart

...