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 16, 2019 in Data Analytics by nikitha
2,149 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
• 33,030 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
• 33,030 points
2,597 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
• 33,030 points
3,961 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 30, 2020 in Data Analytics by MD
• 95,460 points
728 views
0 votes
1 answer

Create 3D Pie Chart in R.

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

answered Oct 30, 2020 in Data Analytics by MD
• 95,460 points
3,423 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,350 points
1,918 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
7,997 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
1,173 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
• 33,030 points
1,674 views
0 votes
1 answer

Display no labels in plot - R ggplot

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

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
996 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP