我使用此代码生成2个具有rmarkdown的高图对象:
---
title: "Untitled"
output: html_document
---
```{r library_objects, include= FALSE, echo = FALSE}
library(highcharter)
```
```{r objects, include = T, echo = FALSE}
df1 <- data.frame(data = c(2, 4, 6, 10),
labels = c("A", "B", "C", "D")
)
df2 <- data.frame(data = c(1, 3, 5, 9),
labels = c("Z", "Y", "X", "W")
)
```
```{r charts, include = T, echo = FALSE}
highchart(height = 150, width = 750) %>%
hc_add_series(data = df1$data) %>%
hc_xAxis(categories = df1$labels)
highchart(height = 150, width = 750) %>%
hc_add_series(data = df2$data) %>%
hc_xAxis(categories = df2$labels)
```
我怎样才能设法在同一水平面上显示它们(一个在左边,另一个在右边)?
答案 0 :(得分:0)
在highcharter包中有hw_grid
函数。
```{r charts, include = T, echo = FALSE}
h1 <- hchart(rnorm(100))
h2 <- hchart(sample(head(letters), size = 100, prob = 1:6, replace = TRUE))
hw_grid(h1, h2)
```
还有其他一些软件包可以制作hllwidgets网格,例如trelliscope。也许你想检查它们。