3

I run this code but it does not number my figure

## Including Plots

You can also embed plots, for example (Figure \@ref(fig:titanic))

```{r titanic, fig.cap='(ref:titanic)'}
plot(pressure)
```

What is missing? Do I need to load a library that I am unaware of? The plot looks like this: enter image description here

My file starts like this:

---
title: "Untitled"
output:
  html_document:
    fig_caption: true
---
xhr489
  • 1,957
  • 13
  • 39
  • @ Mikko: No but I have now, see editet question. Still the same. – xhr489 Mar 11 '19 at 10:06
  • @ Mikko: I have updated the YAML header again with the style you wrote but still no change.. Does it look right? – xhr489 Mar 11 '19 at 10:15
  • 2
    Nice that it worked. No shame in making duplicates sometimes :) I will delete the comments once the question is marked as a duplicate by the community. – Mikko Mar 11 '19 at 10:30

1 Answers1

4

This question has been answered here. The answers list several ways to address the problem, and setting your document to bookdown::html_document2 appears to be the simplest solution. I.e. modify your YAML header:

---
title: "Untitled"
output: bookdown::html_document2
---
Mikko
  • 7,530
  • 8
  • 55
  • 92