【问题标题】:How to horizontally align Highcharter objects in Distill article in R Markdown?如何在 R Markdown 的 Distill 文章中水平对齐 Highcharter 对象?
【发布时间】:2020-08-17 01:04:02
【问题描述】:

如何在 R Markdown 的 Distill 网站中将多个 highcharter 对象彼此相邻对齐?我一直在努力

---
title: "Untitled"
output: distill::distill_article
---

```{r, message = FALSE, echo = TRUE}
library(highcharter)
library(dplyr)
data(diamonds, economics_long, mpg, package = "ggplot2")
economics_long2 <- economics_long %>% 
  filter(variable %in% c("pop", "uempmed"))
economics_long3 <- economics_long %>%
  filter(variable %in% c("pop", "unemploy"))

hw_grid(
  hchart(economics_long2, "line", hcaes(x = date, y = value01, group = variable)),
  hchart(economics_long3, "line", hcaes(x = date, y = value01, group = variable)),
  ncol = 2
)
```

在标准 HTML 输出中,即对于 output: html_document,此代码运行良好。但是,对于 Distill 文章,两个 highcharter 对象不会并排打印。

【问题讨论】:

    标签: r highcharts r-markdown r-highcharter


    【解决方案1】:

    到目前为止,仅将fig.show='hold' 添加到块中仍然显示它们是堆叠的,但更加分散。你可能有一些运气在 Rmarkdown 中实现一些 HTML 以进行对齐,我尝试使用 out.width="50%" 作为块参数,但没有运气

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-23
      • 2019-02-04
      • 2023-03-18
      • 2014-09-11
      • 2016-05-06
      • 2013-08-14
      相关资源
      最近更新 更多