我正在尝试使用 Rmarkdown 在 Tufte 讲义文档的边缘添加一个绘图图。原始图 ( h <- ggplot()...
) 是使用创建ggplot2
的,然后转换为 plotly by, ph <- ggplotly(h)
。
当我将原始 ggplot 图表包含到 Tufte 文档中时,它工作正常,但我失去了 plotly 图表的动态功能。
```{r margin1, echo=FALSE, message=FALSE, warning=FALSE, fig.cap = "Number of countries per survey gap", fig.margin = TRUE}
h
```
然而,当我使用 plotly 图表ph
时,它现在看起来像这样,
```{r margin1, echo=FALSE, message=FALSE, warning=FALSE, fig.cap = "Number of countries per survey gap", fig.margin = TRUE}
ph
```
如您所见,图像现在有一个交互式工具提示,但它位于文本正文而不是边缘。但是,请注意图表的标题位于边缘而不是图表下方,因此它似乎部分起作用。
如何将绘图图表移动到边缘?
谢谢,