hughjonesd / ggmagnify

Create a magnified inset of part of a ggplot object
https://hughjonesd.github.io/ggmagnify/
Other
275 stars 3 forks source link

an issue with `shape = "ellipse"` #10

Closed Syutenjyo closed 1 year ago

Syutenjyo commented 1 year ago

when i draw an ellipse annotation in geom_magnify, it just worked wrong

ggplot(diamonds[diamonds$carat>1.2,], aes(carat, depth, color = cut)) + 
  geom_point() + 
  geom_magnify(from=c(1.8,63,2.2,67),to=c(3.6,48,6,58),shadow = T,shape = "ellipse") +
  coord_cartesian(clip = "off") + 
  theme(legend.position = c(1.15,.75),plot.margin = margin(20,90,10,10))

image the annotation still looks like a rectangle thogth circled in an ellipse ┗( T﹏T )┛

hughjonesd commented 1 year ago

You need to use a device which supports masks, also R 4.2 or higher.

Syutenjyo commented 1 year ago

thanks, when i export as a pdf file, the ellipse annotation works.