wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
701 stars 84 forks source link

Explanation of how align_plot, ggdraw, and draw_plot work together for dual-y-axis plots. #191

Open abalter opened 1 year ago

abalter commented 1 year ago

I'm looking at this example. Also here.

One of the reasons I turned to cowplot is because the native ggplot sec.axis method feels hacky, especially with the confusing scaling issue. Unfortunately, I'm not following the logic in how it works in cowplot either. For example, in

ggdraw(aligned_plots[[1]]) + draw_plot(aligned_plots[[2]])

I'm confused why there isn't more symmetry between the two plots. It makes me feel like I'm doing something I'm not supposed to.