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