Plot with 2 y axes with different scale on a single plot using ggplot2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Plot with 2 y axes with different scale on a single plot using ggplot2

adeeyo
This post has NOT been accepted by the mailing list yet.
Hi All,

I have three variables (x, y1, y2) with y1 and y2 having different scale. Kindly help me how to do the plot in ggplot2 with x on x axis, y1 and y2 on left and right y axis respectively. The data is shown below.

x     y1          y2
2017   0.2555         655
2018   0.461926745 566
2019   0.594491867 363
2020   0.679623819 233
2021   0.734294679 140

Your prompt response will be appreciated.

Thanks.

Adeeyo