Consider the following minimal working example
---
title: MWE
author: "Raniere Silva"
---
```{r include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
reticulate::use_condaenv('faxitron')
```
```{python include=FALSE}
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
```
(ref:mwe) Some text.
```{python mwe, echo = FALSE, results = FALSE, message = FALSE, warning = FALSE, fig.cap = '(ref:mwe)'}
data = {
'c': ['R', 'T', 'R', 'T'],
'r': ['1', '1', '2', '2'],
'x': [1, 1, 1, 1],
'y': [1, 2, 2, 1]
}
df = pd.DataFrame(data)
g = sns.FacetGrid(
df,
col="c",
row="r",
sharex=False,
sharey=False,
despine=False,
subplot_kws=dict(projection='polar'),
palette="Blues"
)
_ = g.map_dataframe(
sns.scatterplot,
x="x",
y="y"
)
_ = g.set_titles(
row_template="{row_name}",
col_template="{col_name}"
)
plt.show()
```
When the .Rmd
file is converted to HTML, the intermediate seaborn plots are included:
How can I keep only the first one?
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.10
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 bookdown_0.22 lattice_0.20-41 png_0.1-7 digest_0.6.27 rappdirs_0.3.3
[7] grid_4.0.2 jsonlite_1.7.2 evaluate_0.14 rlang_0.4.11 rstudioapi_0.13 Matrix_1.2-18
[13] reticulate_1.20 rmarkdown_2.10 tools_4.0.2 xfun_0.25 yaml_2.2.1 compiler_4.0.2
[19] htmltools_0.5.1.1 knitr_1.33