4

我有一个足够大的图,需要在 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。染色体右侧的标签表示对生殖力 (c)、生殖力和存活率 (s) 以及生殖力和种子质量 (m) 的成分具有多效性影响的 QTL。灰色框表示跨站点年组合的单个性状的共定位 QTL 范围。} \end{figure}

如果我不使用横向(即省略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'

任何人都可以为此建议解决方法吗?

4

1 回答 1

4

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

```{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))
```
于 2018-07-03T13:29:04.897 回答