When knitting my R Markdown document (papaja::apa6_pdf), my figure caption appears in the figure legend. This is the code to generate my figure:
{r RT_pilot, echo=FALSE, fig.cap="\\label{fig:RT_pilot}Median search time."}
ggplot(data=median_search_times,
aes(x=set_size, y=median_RT, group=response)) +
geom_line(aes(linetype = response))
My YAML is
title : "my title"
shorttitle : "short title"
author:
- name : "me"
# affiliation : "1"
# corresponding : yes # Define only one corresponding author
# address : "Postal address"
# email : "[email protected]"
- name : "my supervisor"
authornote: |
abstract:
<!-- -->
keywords : "keywords"
wordcount : "X"
bibliography : ["r-references.bib"]
floatsintext : yes
figurelist : no
tablelist : no
footnotelist : no
linenumbers : yes
mask : no
draft : no
documentclass : "apa6"
classoption : "man"
output : papaja::apa6_pdf
In the output file, my figure legend is:
"Figure 2. (#fig:RT_pilot)Median search time by distractor set size for the two search tasks and two responses. Correct responses only. Error bars represent the standard error of the median."
How can I make the figure label disappear?
Just wrapping up what has been written elsewhere:
_
(underscores) in the code-chunk name are replaced with -
(minus signs). This is because papaja
extends the bookdown
package that requires code-chunk names not to contain underscores.\label{}
), because it is possible to reference a figure by chunk name. Here we use RT-pilot
as chunk name:```{r RT-pilot, echo=FALSE, fig.cap="Median search time."}
library(ggplot2)
ggplot(data = npk) +
aes(x = N, y = yield, group = block) +
geom_line(aes(linetype = block))
```
The figure can then be referenced in text by writing:
Figure \@ref(fig:RT-pilot) shows some interesting stuff...