hal9 icon indicating copy to clipboard operation
hal9 copied to clipboard

Can't initialize objects with ggplot

Open javierluraschi opened this issue 3 years ago • 0 comments

This works:

library(ggplot2)
h9_image("image", {
  ggplot(data=iris,aes(x=iris[,1], y=iris[,2])) + geom_point() + theme_minimal()
})

but this doesn't:

library(ggplot2)
plot1 <- ggplot(data=iris,aes(x=iris[,1], y=iris[,2])) + geom_point() + theme_minimal()

h9_image("image", plot1)

In theory, this should also work since we would convert the ggplot object into a function that returns that object, not sure why this is not working.

I think this makes sense to support since I expect a lot of users to start working from notebook code. The most natural approach to do is to convert the output of the notebook to static output first, then incrementally add callback functions to update dynamically, etc.

javierluraschi avatar Sep 22 '22 18:09 javierluraschi