Open theanita1 opened 1 month ago
Hi Anita,
Thanks for letting know!
First question is does this scale function only work with the ggplot_sir function? Asking because when you click on it from the Manual page it takes you to the usage examples for that function.
Yes, and good point, should be moved to another place in the documentation. I'll look into it!
Hi Mathijs
In poking around the scale_x_mic function I came across the scale_y_percent function, so I thought I'd try it out because I'm currently running my MIC plots with the scale_y_continuous with a bunch of math that I need to calculate for each chart (see coding below).
First question is does this scale function only work with the ggplot_sir function? Asking because when you click on it from the Manual page it takes you to the usage examples for that function.
I tried it out in my function that uses autoplot but it didn't work - the first chart is using the scale_y_percent, and the second is using my current scale_y_continuous. Am sharing so that eventually it could be as easy as adding scale_y_percent rather than having to individually calculate and recode for each chart
`mic_graph<- function(mic_dat, organism, antibiotic){autoplot(mic_dat, mo = {{organism}}, ab = {{antibiotic}}, guideline = "EUCAST 2022", include_PKPD = F, ylab = translate_AMR("Proportion"), expand = T)+ theme_classic()+ theme(legend.position.inside = c(.95, .95), legend.justification = c("right", "top"))+ ggtitle("")+ scale_x_mic()}
mic_graph(sau_mic_sc1$VAN, "sau", "Vancomycin") + ggtitle("", subtitle = "subcohort, n = 461") + scale_y_continuous(labels = function(x) paste0(round(x/461*100,1), "%"), breaks = seq(0, 461, 115.25), expand = expansion(mult = c(0, 0.1)), limits = c(0, 461))
the seq() values are min, max, and 1st quartile, i.e. n/4
`