How can I plot two variable with two different scales (2 y-axis)? I want to show a pattern relating to size max 15) vs. concentration ( up to 1500 units) then use gganimate to show how they change by the years , is there is a way to do it in ggplot2?
You can use sec_axis()
function, but have in mind that all secondary axes must be based on a one-to-one transformation of the primary axes.
If you need more specific help please provide a minimal REPRoducible EXample (reprex). A reprex makes it much easier for others to understand your issue and figure out how to help.
2 Likes
To elaborate a bit on @andresrcs answer, the lack of a second y-axis (as is known from e.g. Excel) is an active choise of omission from Hadley Wickham. You can see his argument here:
Cheers
Steen
2 Likes
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.