首页 > 解决方案 > 在 Rstudio 之外的 rmarkdown 笔记本(html 笔记本)中使用 plotly

问题描述

是否可以使用html_notebookakar notebook格式plotly

当我使用下面显示的 rmarkdown 文件(名为temp.Rmd)时,我可以knit to HTML并且一切正常——也就是说,我可以查看正确的temp.html文件。但是,当我使用打开预览窗格的Preview Notebook按钮或查看文件时,我会丢失输出。RStudiotemp.nb.htmlplotly

temp.Rmd

---
title: "R Notebook"
output:
  html_notebook: default
  html_document:
    df_print: paged
---

Some text here.

```{r message = FALSE, warning = FALSE}
library(ggplot2)
library(plotly)

p <- ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point()
ggplotly(p, width = 500, height = 500)

mtcars
```

More text here.

会话信息

Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, mingw32             
 ui       RStudio (1.2.593)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/New_York            
 date     2018-05-01      

 ggplot2     * 2.2.1.9000 2018-04-27 Github (tidyverse/ggplot2@1d537ce)
 plotly      * 4.7.1.9000 2018-04-27 Github (ropensci/plotly@38f447f)  

标签: rrstudior-markdownr-plotlyggplotly

解决方案


推荐阅读