Skip to content

Need to explicitly print to serialize a ggplot object #78

Open

Description

@edgararuiz

If I don't run print(), it will return "error": "500 - Internal server error". In the following reprex I have one that works and one that does not:

library(plumber2)
library(ggplot2)

#* Get the state's plot
#* @get /dontwork
#* @serializer png
function() {
  p <- ggplot(mtcars) +
    geom_point(aes(mpg, wt))
  p
}

#* Get the state's plot
#* @get /works
#* @serializer png
function() {
  p <- ggplot(mtcars) +
    geom_point(aes(mpg, wt))
  print(p)
}

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