Setting dual axis y min on ggplot

I'm having a hard time setting a y min on a dual axis using ggplot. I understand it's not best practices, but a client is requesting it.

Following a post found on stackoverflow r - Y min value on Dual Axis Chart - Stack Overflow

It seems that something simple isn't as straightforward. In the example on stack, how would you use a dynamic min for both primary and secondary axis?

I'm not understanding the goal of your question. On a two axis plot, you can set the minimum of the principal y axis with the limits argument of scale_y_continuous and that will set the minimum of the secondary axis through the transformation used in sec_axis(). I guess you want to calculate that minimum on-the-fly. What is the rule or the goal for setting the minimum? That is, what do you want to achieve that the automatic scaling of ggplot does not?
Sorry if I'm being dense.

This topic was automatically closed 42 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.