1

This is what my code looks like

    library(plumber)
    data(mtcars)
    test=mtcars
    #' @get /graph
    #' @png
    makePlot <- function(){
      par(mfrow=c(2,1))
      hist(test$mpg)
      hist(test$wt)
    }

    r <- plumb("plum_api.R") 
    r$run(port=8000)

But in the output I see only one graph.

Aradhya Kasat
  • 221
  • 1
  • 11

1 Answers1

0

This is not a solution to the problem, but a personal test of the code given above.
I created the file myfile.R with the following code:

# myfile.R

#* @get /graph
#* @png
makePlot <- function(){
      data(mtcars)
      test=mtcars
      par(mfrow=c(2,1))
      hist(test$mpg)
      hist(test$wt)
}

and then I ran within R the following commands:

r <- plumb("myfile.R")
r$run(port=8000)

This is what I got from the browser:

enter image description here

Hope this can help you.

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58