Creating R- pie chart using R programming.
# Create data for the graph.
x <- c(20, 20, 10,50)
labels <- c("Delhi","Haryana","Punjab","Mumbai")
piepercent<- round(100*x/sum(x), 1)
# Give the chart file a name.
png(file = "city_my.jpg")
# Plot the chart.
pie(x, labels = piepercent, main = "City pie chart",col = rainbow(length(x)))
legend("topright", c("Delhi","Haryana","Punjab","Mumbai"), cex = 0.8,
fill = rainbow(length(x)))
# Save the file.
dev.off()
