I was plotting a bar plot using ggplot and I created this function as a web api using plumber package in R.
library(plumber)
library(ggplot2)
#' @get /histogram_test
#' @png
histogram_test <- function(){
mtcars=mtcars
b=ggplot(mtcars,aes(mtcars$cyl))
b+geom_bar()
}
Then I run:
r <- plumb("plum_api.R")
r$run(port=8000)
But this does not return the plot on the browser.