How to plot two y-axis data in R using ggplot2

r
visualization
ggplot2

#1

Hello,

I have two aggregated data info which I would like to plot vs a x- variable in R using ggplot2

I am currently being able to plot only

using

ggplot(data = store_sales_time, aes(store_type,fill = store_type,stat = "identiy"))+
                                            geom_bar(aes(x = store_type,fill = store_type,stat = "identiy"))

I want to display both the store counts and average of unit sales grouped by store_type on the y-axes.
Can someone please help me out on how to do this in R?


#2

You can use the following links to work around your problem of dual Y-axis


http://robjhyndman.com/hyndsight/r-graph-with-two-y-axes/
https://rpubs.com/kohske/dual_axis_in_ggplot2