# NOT RUN {
if(interactive()) {
######### loon --> gg #########
# loon 3D plot
l <- with(quakes,
l_plot3D(long, lat, depth, linkingGroup = "quakes")
)
# equivalent to `loon2ggplot(l)`
g <- loon.ggplot(l)
g # a ggplot object
######### gg --> loon #########
# ggplot histogram
g <- ggplot(iris, mapping = aes(Sepal.Length, fill = Species)) +
geom_histogram()
# equivalent to `ggplot2loon(g)`
l <- loon.ggplot(g)
l # a loon widget
######### lggplot #########
p <- l_ggplot(mpg, aes(displ, fill = factor(cyl))) +
geom_histogram()
class(p)
# Function `print.lggplot` is called automatically
p
# Function `loon.ggplot` helps to return a loon widget
q <- loon.ggplot(p)
q
}
# }
Run the code above in your browser using DataLab