在A R降价文件,没有人知道为什么out.width,out.height,figure.width并figure.height产生一个PDF文件时参数不plotly改变图表的大小?(我确切地说这些参数可以完美地使用plot函数)
请在下面找到带有 Rmarkdown 文件的可复制示例
在这个例子中,我希望 plotly 图表像 plot 图表一样占据整个工作表。
---
title: "Change chart size chart on pdf file using plotly"
output:
pdf_document: default
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo=FALSE,message=FALSE)
```
## Parameters doesn't work with plotly
```{r, out.width='100%',out.height='100%',fig.height=20, fig.width=15, fig.align="left"}
library(plotly)
plot_ly(x = cars[1:10,]$speed,y = cars[1:10,]$dist)
```
## Parameters works using plot function
```{r,out.width='130%',out.height='100%', fig.height=20, fig.width=15, fig.align="left"}
plot(cars[1:10,])
```
Run Code Online (Sandbox Code Playgroud)
当我尝试将Rmarkdown文档编译为pdf时,出现以下错误:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
Run Code Online (Sandbox Code Playgroud)
有人知道这意味着什么吗?