如何在四开图子标题中添加 R 内联代码

问题描述 投票:0回答:1

在四开本中,我尝试在图形子标题中添加内联代码,我尝试了几种方法,但似乎都不起作用。以下是一个可重现的示例:

test=403.87
#| label: example
#| code-fold: true
#| fig-show: "hold"
#| layout-ncol: 2
#| fig-cap: !expr "paste0('R expression in the caption works: ',test)"
#| fig-subcap: 
#|   - !expr "test" 
#|   - !expr "paste0('R expression in the subcaption does not work: ',test)"

library(ggplot2)
ggplot(airquality, aes(Temp, Ozone)) + 
        geom_point() + 
        geom_smooth(method = "loess", se = FALSE)
ggplot(airquality, aes(Temp, Ozone)) + 
        geom_point() + 
        geom_smooth(method = "lm", se = FALSE)
r quarto
1个回答
0
投票

不支持此功能。四开本开发人员建议采用这种方法:

fig-subcap

产生以下输出:

sreenshot of rendered html showing captions and subcaptions

© www.soinside.com 2019 - 2024. All rights reserved.