Plotting a Bar Chart and Overlaying it with a Line Chart w/o a Secondary Axis

Hello,

I'm creating a bar chart using ggplot2 which I'd like to overlay with a line chart and then add data values above/below the line . I can overlay the line chart, however I'm running into issues trying to bring the line chart to scale. I know I could use the scale_y_continous to scale the line chart but I do not want a secondary y-axis. Is there a way where I can scale the line chart and add the data value above/below the graph without adding a secondary y-axis.

df<-data.frame(
Type=c("A","A","A","B","B","B"),
Quarter=c("Q1","Q2","Q3","Q1","Q2","Q3"),
Score=c(1360,1330,1345,1200,1215,1230),
WARate=c(.04,.0341,.0339,.04,.0341,.0339))
df%>%
group_by((Quarter))%>%
ggplot(aes(x=(Quarter), y=Score,fill=Type))+
geom_bar(stat = "identity")+
geom_text(aes(label = format(round(stat(y),0),big.mark=","), group = Quarter),
          stat = 'summary', fun = sum, vjust = -.25)+
geom_line(aes(x=Quarter,y=WARate),group = 1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.