4

I have an issue very similar to this thread Combining Bar and Line chart (double axis) in ggplot2.

I followed the answer and everything works perfectly well. However, I have very small proportions (secondary axis) so I want to change the limits of the secondary y-axis. Is there a simple way to do that?

I saw older threads where the answer was to merge the two plots. I was wondering if there may be a new more simpler way to address the limit issue.

Thanks!

user3047435
  • 151
  • 4
  • 13
  • 2
    By design, `sec_axis()` in ggplot will only accept one-to-one transformations of the original axis. Your options are either to calculate the formula that will transform your data and secondary axis to achieve the desired limits, or to plot your data on two separate plots. There is not a built in method to specify unique limits for the primary y-axis and secondary y-axis. – Jan Boyer Jan 19 '18 at 17:37
  • Thanks! I played around with the transformation formula and I was able to achieve the desire limit. I don't really understand what the transformation formula is doing. Would be able to kindly explain or point me to a source that does? – user3047435 Jan 19 '18 at 17:54
  • 1
    The best explanation of seen of secondary axis transformations is [here on Rpubs](https://rpubs.com/MarkusLoew/226759) – Jan Boyer Jan 19 '18 at 18:03

0 Answers0