r - R markdown flexdashboard - ramchart & highcharter - 显示问题
问题描述
我在 R Markdown (flexdashobard) 中显示图表时遇到问题。我有多个页面 (3)。在 R 设置中,我加载 RData。
什么时候:
- 在第一个中,我有来自 highcharter 包的图表;
- 在第二个 - 来自 rpivotTable 的图表;
- 在第三个 - 来自 ramcharts 的图表
而不是第一页和第二页中的图表,我看到了某种代码(它看起来像图表选项),在第三页中,所有内容都按原样显示。
在 R 设置中,我加载库 highcharter(它也在 .RData 中加载!),所有内容都显示在第一页和第二页中,但我在第三页(空白框)中看不到图表。
什么时候:
- 在第一个 - 来自 ramcharts 的图表;
- 在第二个 - 来自 rpivotTable 的图表;
- 在第三 - 来自 highcharter 的图表
一切都按原样显示。
我到处使用选项:
{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE}
您知道我应该使用哪些选项吗?
谢谢!
编辑 - 示例代码
示例 .R 代码:
library(rAmCharts)
library(highcharter)
library(rpivotTable)
#ramchart
chart_1 <- amPlot(x=iris$Sepal.Length, y=iris$Sepal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")
chart_2 <- amPlot(x=iris$Sepal.Length, y=iris$Petal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")
chart_3 <- amPlot(x=iris$Petal.Length, y=iris$Petal.Width, col="orange")%>%
amLines(y=iris$Petal.Length, col="black")
#pivot
pivot <- rpivotTable(iris, aggregatorName="Sum", vals="Petal.Length",
cols=c("Species"), rendererName="Line Chart" )
#highcharter
hchart_1 <-
highchart() %>% hc_chart(type = "column")%>%
hc_xAxis(categories = iris$Species) %>%
hc_add_series(data = iris$Sepal.Length, name = "Sepallength", color = "yellow", visible = TRUE)
save.image("iristest.RData")
示例 R.Markdown 代码:
---
title: iris test
output:
flexdashboard::flex_dashboard:
theme: yeti
orientation: rows
---
```{r setup, include=FALSE}
load("iristest.RData")
```
highchart
=====================================
Column {width=700px}
-----------------------------------------------------------------------
### Chart1
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE}
### ch1
`hchart_1`
```
Column {width=700px}
-----------------------------------------------------------------------
### ch1
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE,message=FALSE}
### Chart1
`hchart_1`
```
pivot
=====================================
Column {width=700px}
-----------------------------------------------------------------------
### pivot
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE}
###
pivot
```
ramchart {data-orientation=columns}
=====================================
Column {width=700px}
-----------------------------------------------------------------------
### abc
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE}
### abc
chart_1
```
### abc
```{r,results='asis',echo=FALSE,fig.align='center',warning=FALSE, message=FALSE}
### abc
chart_3
```
解决方案
推荐阅读
- sql - 如何从 XACT_ABORT 捕获/保存日志
- android - java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) 在 Android 8.0 的 0 之前开始
- database - 本地 WordPress 开发数据库连接
- mongodb - 不同Mongo版本之间的MongoDB数据文件夹备份与恢复
- hyperledger-fabric - 如何在超级账本作曲家的自定义查询中包含关系
- javascript - 如何通过给我的在 wordpress 中添加过滤器系统数据属性
- android - 如何从 Fire Base 控制台上的单个应用程序向不同的包名称 apk 发送推送通知?
- apache-kafka - 错误 org.apache.kafka.common.errors.InvalidReplicationFactorException:
- xpages - 如果其中的数据不会从调用 xsp 中保存,那么 xpages xp:include 标记的意义何在?
- jquery - 带有上一个和下一个按钮的 Bootstrap 4 个选项卡