Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在R标记中引用图形_R_Plot_Reference_R Markdown - Fatal编程技术网

如何在R标记中引用图形

如何在R标记中引用图形,r,plot,reference,r-markdown,R,Plot,Reference,R Markdown,我想引用R标记代码中的箱线图。我试着这样做,但没有成功: text text text ([Figure 1](#fig1)) text text text {#fig1} chunk: ::: ```r df$NF <- df$`non-failing heart (NF)` df$F <- df$`failing heart (F)` boxplot(df[3:4], data=df, cex.lab=0.65, xlab=&q

我想引用R标记代码中的箱线图。我试着这样做,但没有成功:

text text text ([Figure 1](#fig1)) text text text

{#fig1}
chunk:
:::
```r 
df$NF <- df$`non-failing heart (NF)`
df$F <- df$`failing heart (F)`
boxplot(df[3:4],
        data=df,
        cex.lab=0.65,
        xlab="Fig. 1 IRE binding activity for non-failing (NF) and failing (F) hearts.",
        ylab="IRE binding activity (%)",
        col="orange",
        border="brown",
        ylim = c(0, 120)
)
```

:::
文本([图1](#图1))文本
{#图1}
块:
:::
```r

df$NF使用bookdown。然后你可以交叉参考数字

text text (fig. \@ref(fig:blabla))

```{r blabla, fig.cap = "caption"}
plot(1:2, 1:2)
```

有关更多信息,请参见

谢谢您的帮助,我尝试了您的建议,但它将被视为文本,这样:(fig.@ref(fig:blablabla)))听起来好像您没有使用bookdown输出格式。选择其中一种bookdown输出格式并构建书籍(而不是编织Rmd)。谢谢,但您的意思是我应该在页眉中定义bookdown输出?是的,您需要在yaml页眉中定义bookdown输出格式