当本地打开使用flexdashboard生成的html文件时,是否有方法获取要渲染的plotly图形?
我使用flexdashboard和plotly graphics生成html文件已有一段时间了,直到最近才注意到,当我从本地驱动器打开文件时,我的仪表板中的选项卡并没有呈现plotly图形 考虑这个基本的.rmd文件:当本地打开使用flexdashboard生成的html文件时,是否有方法获取要渲染的plotly图形?,r,knitr,r-plotly,flexdashboard,R,Knitr,R Plotly,Flexdashboard,我使用flexdashboard和plotly graphics生成html文件已有一段时间了,直到最近才注意到,当我从本地驱动器打开文件时,我的仪表板中的选项卡并没有呈现plotly图形 考虑这个基本的.rmd文件: --- title: "Test Dashboard" output: html_document: flexdashboard::flex_dashboard pdf_document: default --- --- ```{r setup, include=F
---
title: "Test Dashboard"
output:
html_document: flexdashboard::flex_dashboard
pdf_document: default
---
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(arules)
library(plotly)
library(dplyr)
library(DT)
library(reshape2)
library(stringr)
library(crosstalk)
rf<-data.frame(happiness=c(1,2,3,4,5,6,7,8),
laziness=c(3,4,6,1,2,5,6,1))
```
Association Rules
==================================
Column {.tabset}
----------------------------------
### Table
```{r what2, echo=FALSE, collapse=TRUE, message=FALSE,warning=FALSE}
datatable(rf, filter = 'top', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons =
c('csv', 'excel','copy', I('colvis')),pageLength = 20, autoWidth = TRUE),rownames = FALSE)
```
### Plot
```{r what, echo=FALSE, collapse=TRUE, message=FALSE, warning=FALSE}
P<-plot_ly(rf,
x=~happiness,
y=~laziness,
color = ~happiness)
P
```
---
标题:“测试仪表板”
输出:
html_文档:flexdashboard::flex_dashboard
pdf_文档:默认值
---
---
```{r设置,include=FALSE}
knitr::opts_chunk$set(echo=FALSE)
图书馆(阿鲁莱斯)
图书馆(绘本)
图书馆(dplyr)
图书馆(DT)
图书馆(E2)
图书馆(stringr)
图书馆(串扰)
rfplotly似乎无法获得默认的宽度和高度,因此使用NULL。在plot__-ly调用中手动设置这些选项将显示绘图,例如:
P<-plot_ly(rf,
x=~happiness,
y=~laziness,
color = ~happiness,
width = 600,
height = 400)
flexdashboard中的函数renderPlotly()动态调整绘图图的大小。我在Flexdahboard上的一篇博文中使用了,请参见: