Closed Lextuga007 closed 1 year ago
I don't really think we should have this on here to be honest. This blog post convinced me that they're just best avoided entirely https://blog.datawrapper.de/dualaxis/
Yeah, I agree it's not something we should do but people do so I would like something, somewhere saying it's a thing but it's a thing you really should consider twice about doing. It's possibly better as a blog?
Yes, a blog would be better
On Thu, Feb 23, 2023 at 9:14 AM Zoë Turner @.***> wrote:
Yeah, I agree it's not something we should do but people do so I would like something, somewhere saying it's a thing but it's a thing you really should consider twice about doing. It's possibly better as a blog?
— Reply to this email directly, view it on GitHub https://github.com/nhs-r-community/demos-and-how-tos/issues/52#issuecomment-1441420089, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTSW5B6DJOGPI3VCOB7O3WY4TBBANCNFSM6AAAAAAVETXOXY . You are receiving this because you commented.Message ID: @.***>
Done https://nhsrcommunity.com/code-snippets-2-scale-y-axes-in-ggplot2/ and the code used to produce the html which was copied to the website https://github.com/nhs-r-community/NHSRblogs/blob/main/20230328_3-axes-ggplot/3-axes-ggplot.qmd
Question posed on the Slack. Code was suggested but it also led to a question of when this can be misleading:
Just note that in my example code, I “scaled” the axis by dividing the original values of the 2ndary variable by 10, ggplot2::aes(x = ID, y = hp / 10, then I multiplied the scale by 10 (so the axis labels have the original scale), ggplot2::sec_axis(~.*10. Try removing those, so you will see the difference and try playing with different scaling values.
If you mean 2 y-axes it's possible now https://ggplot2.tidyverse.org/reference/sec_axis.html but I'd caution using it. I had a chart I showed people for years with 2 axes comparing the Trust deaths with the Region to show the seasonal pattern of deaths were the same - but not comparing numbers. I always mentioned it in meetings as it looked like the numbers of Trust deaths were higher than Region - which is impossible as we are part of the region. Turned out it had was still being read like that.
Same data but different types of charts: https://blog.datawrapper.de/dualaxis/