I want to create a pdf document with R markdown and python syntax and I want to use LaTeX for formatting. Almost everything works at least OK except one really annoying thing: When I want to have a plot in my document the file for this plot is automatically saved in the subfolder ...-files/figure-latex. Now this works perfectly for plots made with R but not with python. The plots are named after their chunk names and it is even no problem if the chunks don't have any names in R. Every plot from python chunks (that I've named!) is called pysetup-1.pdf so they are overwritten. I've named my first python chunk pysetup but the other ones have completely different names (now matter how I name the chunks, the file is/the files are always named after the first python chunk ...). I really have no idea what I've probably made wrong.
This is my YAML:
---
title: "xyz"
author: "TobiSonne"
date: "`r format(Sys.Date(), '%d.%m.%Y')`"
output:
pdf_document:
number_sections: true
lang: de
fontsize: 12pt
header-includes:
- \usepackage{float}
- \pagenumbering{gobble}
---
These are my settings:
knitr::opts_chunk$set(
fig.height = 4,
fig.width = 7,
echo = TRUE,
fig.align = "center",
fig.pos = "H",
out.extra = "",
warning = FALSE,
message = FALSE)
library(reticulate)
library(xtable)
library(magrittr)
options(xtable.include.rownames = FALSE,
xtable.comment = FALSE,
xtable.table.placement = "H",
digits = 2,
scipen = 999)
Everything works great with that, it's formatted perfectly how I want except for that problem ...
This is a python code chunk with a plot, the other one looks almost identically except for a different caption:
{python boxplotdauer, fig.cap = "Boxplot", echo = FALSE, fig = TRUE}
get_boxplot("Dauer")