【发布时间】:2020-10-21 13:37:21
【问题描述】:
我想使用library(c3) 在我的 rmarkdown 文档中包含一个仪表图。不过差距太大了:
---
title: "Gauge"
output: html_document
---
# Gauge
Too big gap to the gauge:
```{r, echo = FALSE, message = FALSE}
library(c3)
data.frame(x = 50) %>%
c3() %>%
c3_gauge()
```
This is fine.
这会导致以下输出:
仪表上方的空白和文本太大。我怎样才能减少它?在c3 中玩height/width 没有帮助。
在@Daniel 的回答之后,我玩了几个选项,与我的第一次尝试相反,设置 ehitgh 确实起到了作用(改变无花果高度也是如此) - 很奇怪:
---
title: "Gauge"
output: html_document
---
# Gauge
Too big gap to the gauge:
```{r, echo = FALSE, message = FALSE}
library(c3)
data.frame(x = 50) %>%
c3() %>%
c3_gauge()
```
This is fine.
# Gauge fig.height = 2, height = 200
Too big gap to the gauge:
```{r, echo = FALSE, message = FALSE, fig.height=2}
library(c3)
data.frame(x = 50) %>%
c3(height = 200) %>%
c3_gauge()
```
This is fine.
# Gauge height = 200
Too big gap to the gauge:
```{r, echo = FALSE, message = FALSE}
library(c3)
data.frame(x = 50) %>%
c3(height = 200) %>%
c3_gauge()
```
This is fine.
# Gauge fig.height = 2
Too big gap to the gauge:
```{r, echo = FALSE, message = FALSE, fig.height=2}
library(c3)
data.frame(x = 50) %>%
c3() %>%
c3_gauge()
```
This is fine.
【问题讨论】:
标签: r r-markdown c3.js htmlwidgets