ggplot2 - Convert the labels in

0 votes
I have created a bar chart using ggplot2 in R. Now i want to change the labels in the plot to %. How to acheive this?
Aug 1, 2019 in Data Analytics by koyila
407 views

1 answer to this question.

0 votes

Use geom_label or geom_text and provide labels like below.

> ggplot(mpg,aes(cyl))+geom_bar(stat = "count")+geom_label(aes(cyl,85,label=paste(cyl,"cyl",sep = " ")))

In your case, update paste fucnction with paste([field/variable], "%", sep = " ")

I hope this will do.

answered Oct 30, 2019 by Cherukuri
• 33,030 points

Related Questions In Data Analytics

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,790 points
896 views
0 votes
1 answer

% of nulls for each column in the dataset - R

Use code as below -  lapply(air,function(x) { length(which(is ...READ MORE

answered Jul 4, 2019 in Data Analytics by anonymous
• 33,030 points
867 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,271 views
0 votes
1 answer
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, 2020 by MD 8,494 views
0 votes
1 answer

Aligning title in ggplot2

You can use the theme layer to ...READ MORE

answered Apr 27, 2018 in Data Analytics by Bharani
• 4,660 points

edited Jun 9, 2020 by MD 3,457 views
0 votes
1 answer

Changing the order of bars in a bar-plot - ggplot2 - R

You can use the scale_x_discrete() function with ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,660 points
9,489 views
0 votes
1 answer

Showing percentage instead of counts in a bar plot - ggplot2 - R

Load the 'scales' package first, which gives ...READ MORE

answered May 29, 2018 in Data Analytics by Bharani
• 4,660 points
3,526 views
0 votes
2 answers

What is the difference between %% and % in R programming?

HI, %% returns remainder in case of numeric ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 33,030 points
1,959 views
0 votes
2 answers

Change the default order of labels of factor in R

You can also use relevel() to change ...READ MORE

answered Jun 27, 2019 in Data Analytics by sindhu
2,505 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