pie chart using ggplot - R

0 votes
How to draw a pie chart using ggplot? I cant find any pie function for geom_*. Can someone help?
Aug 15 in Data Analytics by nikitha
23 views

1 answer to this question.

0 votes

Hi, even I was searching for this answer, I found the way later.

You need to use geom_bar and then later convert it to polar coordinates to get a pie chart.

Let me show an example,

mpg1 = mpg %>% arrange(cyl)

ggplot(mpg1,aes(x="",y=displ,fill = cyl))+geom_bar(stat = "identity")+coord_polar("y",start=0)+scale_fill_continuous(type = "viridis")+theme_minimal()+theme(axis.text = element_text(color = "white"))

answered Aug 19 by anonymous
• 28,040 points

Related Questions In Data Analytics

0 votes
0 answers

Create a dual axis column/bar chart using ggplot in R

Hi, i need to create a dual ...READ MORE

Jul 22 in Data Analytics by riya
67 views
+1 vote
1 answer

R programming: Drawing an xbar and R chart using qcc package

Try this: #x-Bar library(qcc) x=c(1080͵ 1390͵ 1460͵ ...READ MORE

answered Jan 25 in Data Analytics by Tyrion anex
• 8,270 points
135 views
0 votes
0 answers

How to edit the labels and limit if a plot using ggplot? - R

How to edit the labels and limit ...READ MORE

Jul 15 in Data Analytics by piyush
13 views
0 votes
0 answers

Edit date values in ggplot line chart -R

Hi, I want to edit the data ...READ MORE

Jul 25 in Data Analytics by rekha
19 views
0 votes
1 answer

How to plot side-by-side Plots with ggplot2 in R?

By Using gridExtra library we can easily ...READ MORE

answered Apr 16, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,569 views
0 votes
1 answer

How to change fill color in each facet using ggplot2?

You can map the facetting variable to ...READ MORE

answered May 8, 2018 in Data Analytics by kappa3010
• 2,020 points
2,899 views
0 votes
11 answers

Changing the legend title in ggplot

Hi, you can also try guides() to ...READ MORE

answered Jul 30 in Data Analytics by Cherukuri
• 28,040 points
5,854 views
0 votes
1 answer

How to order bars in a bar graph using ggplot2?

The key to ordering is to set ...READ MORE

answered Jun 1, 2018 in Data Analytics by DataKing99
• 8,130 points
174 views
0 votes
2 answers
0 votes
2 answers

R maps using Tmaps

Check this out! https://www.youtube.com/watch?v=GMi1ThlGFMo READ MORE

answered Jul 29 in Data Analytics by anonymous
• 28,040 points
26 views