Ara*_*sat 6 r ggplot2 asp.net-web-api plumber
我正在使用 ggplot 绘制条形图,并使用 R 中的管道工包将此函数创建为 Web api。
library(plumber)
library(ggplot2)
#' @get /histogram_test
#' @png
histogram_test <- function(){
mtcars=mtcars
b=ggplot(mtcars,aes(mtcars$cyl))
b+geom_bar()
}
Run Code Online (Sandbox Code Playgroud)
然后我运行:
r <- plumb("plum_api.R")
r$run(port=8000)
Run Code Online (Sandbox Code Playgroud)
但这不会在浏览器上返回绘图。