Figure caption doesn’t show up below figure in knitted document

This error happens when you knit to PDF and your figure caption doesn’t show up despite having the correct code within your Rchunk.

Solution: One potential cause for this error is that you have text immediately below your R chunk. To fix this error, make sure there is a blank line between the end of your R chunk with the code for the figure and any subsequent text. See the screenshot below for an example with the blank line inserted.

Notice the blank line at line 208 in the above screenshot.