如果横向太长,Bookdown 图标题会失败?

tel*_*lis 5 r knitr r-markdown reproducible-research bookdown

我有一个足够大的图,需要在 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)
```
Run Code Online (Sandbox Code Playgroud)

问题是,这输出了一个横向图,但标题在 PDF 输出中呈现为正文(即不是图形标题):

\begin{figure} \caption{QTL 每个繁殖植物的果实数量 (Fruits/RP)、每个果实的种子数量 (Seeds/fr)、每个繁殖植物的种子数量 (Seeds/RP)、种子质量 (Sd 质量) 和存活率(幸存者)。箭头表示具有 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))
```
Run Code Online (Sandbox Code Playgroud)

当 时,标题长度是否有上限out.extra='angle=90'

任何人都可以建议解决此问题的方法吗?

Ral*_*ner 5

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

```{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))
```
Run Code Online (Sandbox Code Playgroud)