I am trying to combine observed vs predicted values of different models as lines, along with % error as columns, using a secondary axis. I think I am close to achieving this but it would appear the columns are not plotting on the secondary y axis. Further complicating is the range of ~2.5 to -2.5 required to portray the %Error. I had originally envisioned combining separate line and column plots in a facet, with four facet columns, one for each model, and two rows, based on line and column plots, but that seemed far above my skill level. So, I opted to try combining the column and line in a four panel facet:
ggplot(DatMod) +
geom_line(aes(x = RunYear, y = Observed), size = 1, color="red", group = 1)+
geom_line(aes(x = RunYear, y = Predicted), size = 1, color="black", group = 1)+
geom_col(aes(x = RunYear, y = PERCENT_ERR), size = 1, color = "darkblue", fill = "white")+
scale_y_continuous(sec.axis = sec_axis(~./20000, name = "% Error"))+
facet_grid(rows=vars(Model))
The resulting plot: Predicted vs Observed line with % error secondary Y axis
Thanks for any guidance.