如果景观太长,书本上的图形标题将失败?

时间:2018-07-03 12:17:16

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

我有一个图,该图足够大,需要使用RStudio中的(PDF)书本在纵向文档中绘制风景。该图正在进行中,因此图标题很长,我真的无法再进一步缩小文本了。

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

```{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输出中显示为正文文本(即,不作为图形标题):

  

\开始{图} \标题{每个生殖植物的果实数量的QTL   (水果/ RP),每个水果的种子数(种子/ fr),每个水果的种子数   生殖植物(种子/ RP),种子质量(Sd质量)和存活率   (生存)。箭头表示最可能的QTL位置以及95%的贝叶斯   可靠的间隔,以及瑞典基因型的影响(向上:   表型增加;向下:意大利(红色)的表型降低)和   瑞典(蓝色)。空心箭头显示的QTL可信区间> 15.2cM。   染色体右侧的标签表示具有多效性的QTL   对繁殖力(c),繁殖力和生存(s)的影响以及   繁殖力和种子质量(米)。灰色框表示范围   跨站点/年份组合对单个性状进行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'时字幕长度是否有上限?

有人可以为此建议解决方法吗?

1 个答案:

答案 0 :(得分:3)

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

```{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))
```