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

0 votes

Hi, i need to create a dual axis bar chart and also column chart using 1 variable and a categarical column. Can someone help using ggplot?

Like below charts (only bars)

  

Jul 22 in Data Analytics by riya
99 views

1 answer to this question.

0 votes

Add position = "stack" in geom_bar() function to stack bar over each other.

See the below example.

> ggplot(mpg, aes(displ, hwy, fill = factor(cyl))) + geom_bar(stat = "identity",position = "stack")
answered Nov 4 by sindhu

Related Questions In Data Analytics

0 votes
0 answers
0 votes
1 answer

Rename a single column in dataframe using R

colnames(Samp)[2] <- "newname2" This sets the name of ...READ MORE

answered Apr 13, 2018 in Data Analytics by kappa3010
• 2,070 points
410 views
0 votes
1 answer

How to create a box-plot using “plotly” in R?

You can use this command to create ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
1,323 views
+5 votes
0 answers
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
1,874 views
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

change the color for bars in geom_bar in ggplot

Hi @radha, You can have 2 types of ...READ MORE

answered Jul 24 in Data Analytics by Cherukuri
• 32,260 points
853 views
0 votes
1 answer

Add secondary axis as a dual axis in R plot

You can add a secondary axis in ...READ MORE

answered Nov 4 in Data Analytics by keerthi
149 views
0 votes
1 answer

Replace comma with a period in data cleaning using R

You can use the scan function in ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,040 points
74 views