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, 2019 in Data Analytics by nikitha
573 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, 2019 by anonymous
• 32,490 points

Related Questions In Data Analytics

0 votes
1 answer

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

Add position = "stack" in geom_bar() function ...READ MORE

answered Nov 4, 2019 in Data Analytics by sindhu
567 views
+2 votes
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, 2019 in Data Analytics by Tyrion anex
• 8,550 points
311 views
0 votes
0 answers

Edit date values in ggplot line chart -R

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

Jul 25, 2019 in Data Analytics by rekha
56 views
0 votes
1 answer

Waterfall chart using plotly in R

A simple waterfall chart using plotly - df ...READ MORE

answered Nov 2, 2019 in Data Analytics by Cherukuri
• 32,490 points
586 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

edited Jun 9 by MD 4,152 views
+1 vote
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,090 points
10,322 views
0 votes
11 answers

Changing the legend title in ggplot

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

answered Jul 30, 2019 in Data Analytics by Cherukuri
• 32,490 points
11,747 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,210 points
399 views
0 votes
1 answer

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

Add a limit to axis ticks using ...READ MORE

answered Nov 3, 2019 in Data Analytics by anonymous
• 32,490 points
70 views
0 votes
1 answer

R chart using plotly

Plot_ly example library(plotly) today <- Sys.Date() tm <- ...READ MORE

answered Nov 4, 2019 in Data Analytics by Cherukuri
• 32,490 points
83 views