Add secondary axis as a dual axis in R plot

0 votes
Hi, I just started learning R. Can someone help how to add 3 axis i.e wrt 3 variables to a plot?
Jul 25 in Data Analytics by radha
162 views

1 answer to this question.

0 votes
You can add a secondary axis in ggplot by using sec.axis attribute in scale_* functions.

ggplot object + scale_x_continuous(sec.axis = axis calculation)

Ex:

> plot + scale_y_continuous(sec.axis = ~ .+2)
answered Nov 4 by keerthi

Related Questions In Data Analytics

0 votes
0 answers
0 votes
1 answer

Save a plot as image on the disk using R

Consider for both the situations: 1. Image will ...READ MORE

answered Apr 13, 2018 in Data Analytics by darklord
• 6,190 points
169 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,560 points
3,843 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 28, 2018 in Data Analytics by Bharani
• 4,560 points
1,541 views
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

Duplicate axis for a R plot

Add duplicate axis using dup.axis attribute like ...READ MORE

answered Nov 4 in Data Analytics by radha
51 views
0 votes
0 answers

Edit date values in ggplot line chart -R

Hi, I want to edit the data ...READ MORE

Jul 25 in Data Analytics by rekha
24 views
0 votes
1 answer

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

Add position = "stack" in geom_bar() function ...READ MORE

answered Nov 4 in Data Analytics by sindhu
102 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 32,260 points
169 views