Skip to content

Incompatible with ggplot2 or is it a plot device issue I don't understand? #8

Description

@DOSull

The following model code

extensions [ sr ]

to setup
  clear-all
  sr:setup
  sr:run "library(ggplot2)"
end

to ggplot
  sr:set-plot-device
  (sr:run
    "df <- data.frame(x = rnorm(30), y = rnorm(30))"
    "ggplot(df) + "
    "  geom_point(aes(x = x, y = y))"
  )
  sr:run "ggsave('~/Downloads/test.png')"
  user-message "Plot will close when you close this dialog."
  sr:run "dev.off()"
end  

fails to show a plot in the on-screen plot window, although the expected ggplot shows up as the requested PNG file:

test

The user-message is my way to cleanly close plot devices - so don't worry about that part.

Is this some subtlety or R plotting, specifically in relation to ggplot that I don't understand? Or is it a problem with the Simple R extension? How do I do I to get an on-screen ggplot to show up?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions