Display labels within pie chart

0 votes

Hi, i found out how to plot a pie chart using ggplot, but how to display % value inside chart?

Aug 15, 2019 in Data Analytics by nikitha
1,054 views

1 answer to this question.

0 votes

See below example-

df <- data.frame(
  name = c("sindhu", "karthick", "venu"),
  marks = c(45, 43, 50)
)
ggplot(df, aes(x="", y=marks, fill=name))+
  geom_bar(stat = "identity")+ coord_polar("y", start=0)+
  theme(axis.text.x=element_blank())+
  geom_text(aes(y = marks/3 + c(0, cumsum(marks)[-length(marks)]), label = paste(marks/100,"%")))
answered Nov 2, 2019 by Cherukuri
• 32,910 points

Related Questions In Data Analytics

0 votes
1 answer

pie chart using ggplot - R

Hi, even I was searching for this ...READ MORE

answered Aug 19, 2019 in Data Analytics by anonymous
• 32,910 points
810 views
0 votes
1 answer

How to add labels on bars in bar chart in ggplot?

Use geom_text() to add labels on the ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 32,910 points
1,922 views
0 votes
1 answer

How to create a pie chart in R?

Hi@akhtar, In R the pie chart is created ...READ MORE

answered Oct 29, 2020 in Data Analytics by MD
• 95,060 points
36 views
0 votes
1 answer

Create 3D Pie Chart in R.

Hi@akhtar, A pie chart with 3 dimensions can ...READ MORE

answered Oct 29, 2020 in Data Analytics by MD
• 95,060 points
72 views
0 votes
1 answer

Is it possible to use a where clause within ggplot?

You can use the subset function to filter rows ...READ MORE

answered Nov 5, 2018 in Data Analytics by Kalgi
• 52,290 points
310 views
0 votes
1 answer
+1 vote
1 answer

Error saying cannot open file 'file.pdf' when trying to save a plot in ggplot

You could try adding the following line ...READ MORE

answered Nov 9, 2018 in Data Analytics by Maverick
• 10,840 points
2,812 views
0 votes
1 answer

Creating barplot with standard errors plotted in R

For df1 plot # Group data by when ...READ MORE

answered Nov 12, 2018 in Data Analytics by Maverick
• 10,840 points
336 views
0 votes
1 answer

plot a line chart along with point labels in the plot

Follow the below steps: 1. Create a ggplot ...READ MORE

answered Nov 2, 2019 in Data Analytics by anonymous
• 32,910 points
310 views
0 votes
1 answer

Display no labels in plot - R ggplot

Hi, One small trick is to change the ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 32,910 points
121 views