r - 如何使用管道工在网络上显示/发送 r plotly 图?
问题描述
我有一个情节图,我想使用 R Plumber 在其他 UI(例如角度)上显示情节。
解决方案
这是您的操作方法:
# API for experimenting with html widgets
library(plumber)
library(ggplot2)
library(plotly)
#* @apiTitle HTML widgets API
#* Return interactive plot using plotly
#* @serializer htmlwidget
#* @get /plotly
function() {
p <- ggplot(data = diamonds,
aes(x = cut, fill = clarity)) +
geom_bar(position = "dodge")
ggplotly(p)
}
希望这可以帮助。
来源 - https://github.com/blairj09/plumber-playground/blob/master/experiments/htmlwidgets-exp/plumber.R
推荐阅读
- javascript - 我的 AngularJS 路由正在向 URL 添加额外的输入
- python - 如何从函数返回元组并垂直打印它们?
- java - Java对String数组的ArrayList进行排序
- ios - 从 Swift UI 测试调用类 Objective C 时出错未定义符号
- angular - HttpClient错误处理程序中的角度调用自定义函数
- firebase - 聊天应用 FCM 如何为 Android/iOS 平台编写有效负载
- algorithm - 有效检索动态图的所有对最短路径
- angular - Ionic 3 货币格式
- design-patterns - 工厂方法分解成模块
- scala - Scala - 如何将 Dataset[Row] 转换为可添加到 Dataframe 的列