0
我用ggplot绘制柱状图和我在使用R.管道工包创建这个功能作为Web API我们如何通过管道工web api返回ggplot图?
library(plumber)
library(ggplot2)
#' @get /histogram_test
#' @png
histogram_test <- function(){
mtcars=mtcars
b=ggplot(mtcars,aes(mtcars$cyl))
b+geom_bar()
}
然后我运行:
r <- plumb("plum_api.R")
r$run(port=8000)
但这并不返回情节在浏览器上。
另请参阅[本答案](https://stackoverflow.com/questions/44469026/sequence-of-execution-for-closures/44470288#44470288)它试图解释类似的问题 – Uwe