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 in Data Analytics by nikitha
32 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 by Cherukuri
• 32,260 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 in Data Analytics by anonymous
• 32,260 points
63 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 in Data Analytics by anonymous
• 32,260 points
33 views
0 votes
1 answer

How can I add x and y axis labels in ggplot2 ?

# Load a dataset(to work with) # We’ll ...READ MORE

answered May 16, 2018 in Data Analytics by zombie
• 3,710 points
150 views
0 votes
1 answer

How can I rotate axis labels in R ?

library(ggplot2) p <- data.frame(Day=c("2011-04-11", "2014-05-24","2004-01-12","2014-06-20","2010-08-07","2014-05-28"), Impressions=c(24010,15959,16107,21792,24933,21634),Clicks=c(211,106,248,196,160,241)) p       ...READ MORE

answered May 18, 2018 in Data Analytics by zombie
• 3,710 points
606 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
• 46,040 points
91 views
0 votes
1 answer
0 votes
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,040 points
560 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,040 points
100 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 in Data Analytics by anonymous
• 32,260 points
28 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 in Data Analytics by anonymous
• 32,260 points
38 views