Closed FriederikeHanssen closed 5 months ago
I'm travelling right now but I'd expect you could solve this via the plot
argument. Is there any reason to expect passing after_scale
to geom_magnify
to work?
If you're still interested, I'll need a reproducible example, i.e. one that runs when I copy/paste it.
The following example shows the problem, which only happens when recompute = TRUE
:
library(ggplot2)
ggp <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, shape = Species))
ggp2 <- ggp + geom_point()
from <- c(2.5, 3.0, 5.5, 6.0)
to <- c(3.5, 4.5, 4.5, 5.5)
ggp2 +
scale_y_continuous(labels = scales::label_currency()) +
geom_magnify(from = from, to = to, axes = "xy") # dollars shown on y axis
ggp2 +
scale_y_continuous(labels = scales::label_currency()) +
geom_magnify(from = from, to = to, axes = "xy", recompute = TRUE) # dollars not shown
My thought would be, you probably don't need recompute = TRUE
here. Adding recompute = TRUE
adds a call to lims()
; this is documented, but it does wipe out your existing scale. The other solution is to use the plot
argument to specify exactly what you want the inset plot to be.
Hey!
Thanks for the awesome package. I was trying to format the y-axis labels, which works in the main plot but seems to be ignored in the magnified portion. Is it possible to do this? If so what would be the right way?
Describe the bug A clear and concise description of what the bug is.
To Reproduce
Sequencing_Cost_Data_Table_May2022.xls
Expected behavior I would like the yaxis labels in the magnified plot to also have
$
prepended (among other things)Screenshots
Other information scales lubridate ggmagnify ggpubr ggplot2 "1.3.0" "1.9.3" "0.4.0" "0.6.0" "3.5.0"