【问题标题】:Bookdown figure caption fails if too long in landscape?如果横向太长,Bookdown数字标题会失败?
【发布时间】:2018-07-03 12:17:15
【问题描述】:

我有一个足够大的绘图,需要在 RStudio 中使用 (PDF) bookdown 在原本是纵向文档的情况下绘制横向。图有很多内容,所以图标题很长,我真的不能再减少文字了。

这是我一直在使用的示例代码:

```{r qtl-pleiotropy, out.extra='angle=90', fig.width=25/2.54, fig.height=16.9/2.54, 
     fig.cap="QTL for fruit number per reproductive plant (Fruits/RP), seed number per fruit (Seeds/fr), seed number per reproductive plant (Seeds/RP), seed mass (Sd mass) and survival (Surv). Arrows indicate most-likely QTL position with the 95% Bayesian credible intervals, and the effect of the Swedish genotype (upward: increased phenotype; downward: decreased phenotype) in Italy (red) and Sweden (blue). Open arrows show QTL with credible intervals >15.2cM. Labels on the right of chromosome indicate QTL with pleiotropic effects on components of fecundity (c), fecundity and survival (s) and fecundity and seed mass (m). Grey boxes indicate the range of colocalising QTL for a single trait across site-year combinations."}
hist(rnorm(100)
```

问题是这会输出一个风景图,但标题在 PDF 输出中呈现为正文文本(即不是作为图形标题):

\begin{figure} \caption{QTL 每个生殖植物的果实数量 (Fruits/RP),每个果实的种子数 (Seeds/fr),每个果实的种子数 生殖植物 (Seeds/RP)、种子质量 (Sd mass) 和存活率 (生存)。箭头表示 95% 贝叶斯最可能的 QTL 位置 可信区间,以及瑞典基因型的影响(向上: 表型增加;向下:表型下降)在意大利(红色)和 瑞典(蓝色)。空心箭头显示可信区间 >15.2cM 的 QTL。 染色体右侧的标签表示具有多效性的 QTL 对繁殖力 (c)、繁殖力和存活率 (s) 组成部分的影响以及 繁殖力和种子质量 (m)。灰色框表示范围 将 QTL 定位为跨站点年组合的单一性状。} \end{图}

如果我不使用横向(即省略out.extra='angle=90'),这可行。如果我采用较短的标题块,它也会正确呈现。这有效,例如:

```{r qtl-pleiotropy, out.extra='angle=90', fig.width=25/2.54, fig.height=16.9/2.54, 
     fig.cap="Open arrows show QTL with credible intervals >15.2cM. Labels on the right of chromosome indicate QTL with pleiotropic effects on components of fecundity (c), fecundity and survival (s) and fecundity and seed mass (m). Grey boxes indicate the range of colocalising QTL for a single trait across site-year combinations."}
hist(rnorm(100))
```

out.extra='angle=90'时字幕长度有上限吗?

任何人都可以为此提出解决方法吗?

【问题讨论】:

    标签: r r-markdown knitr bookdown reproducible-research


    【解决方案1】:

    问题不是由字幕长度引起的,而是由未转义的% 引起的。以下对我有用:

    ```{r qtl-pleiotropy1, out.extra='angle=90', fig.width=25/2.54, fig.height=16.9/2.54, fig.cap="QTL for fruit number per reproductive plant (Fruits/RP), seed number per fruit (Seeds/fr), seed number per reproductive plant (Seeds/RP), seed mass (Sd mass) and survival (Surv). Arrows indicate most-likely QTL position with the 95\\% Bayesian credible intervals, and the effect of the Swedish genotype (upward: increased phenotype; downward: decreased phenotype) in Italy (red) and Sweden (blue). Open arrows show QTL with credible intervals >15.2cM. Labels on the right of chromosome indicate QTL with pleiotropic effects on components of fecundity (c), fecundity and survival (s) and fecundity and seed mass (m). Grey boxes indicate the range of colocalising QTL for a single trait across site-year combinations."}
    hist(rnorm(100))
    ```
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-05
      • 1970-01-01
      • 2018-08-16
      • 1970-01-01
      • 1970-01-01
      • 2019-04-13
      • 2016-09-09
      • 1970-01-01
      相关资源
      最近更新 更多