great-northern-diver / loon.ggplot

ggplot to loon
22 stars 2 forks source link

Use Argument `asAes` to maintain the data structure #48

Closed z267xu closed 3 years ago

z267xu commented 3 years ago

An alternative way to maintain the data structure in a large extent of loon in ggplot is to set asAes = FALSE. For example,

p <- l_plot(iris, glyph = sample(c("circle", "ccircle"), 150, replace = TRUE))
g1 <- loon.ggplot(p)
g2 <- loon.ggplot(p, asAes = FALSE)
b1 <- ggplot_build(g1)
b2 <- ggplot_build(g2)
# two layers
length(b1$data)
# only one layer
length(b2$data)