现象
如图\@ref(fig:plotly-scatter)所示
```{python plotly-scatter, fig.cap="JavaScript 库 Plotly 的 Python 接口", echo=FALSE, out.width='65%', eval=knitr::is_html_output()}
import plotly.express as px
px.scatter(
px.data.iris(),
x="sepal_width",
y="sepal_length",
color="species",
template="simple_white",
labels={
"sepal_length": "萼片长度 (cm)",
"sepal_width": "萼片宽度 (cm)",
"species": "种类",
},
title="Edgar Anderson 的鸢尾花数据",
color_discrete_sequence=px.colors.qualitative.Set2
)
```
交叉引用是失效的。
复现
新建 bookdown 新项目,然后将上述代码插入 Rmd 文档,之后编译。
R 包
xfun::session_info('bookdown')
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6.1, RStudio 2021.9.0.351
Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
Package version:
base64enc_0.1.3 bookdown_0.24 digest_0.6.28 evaluate_0.14 fastmap_1.1.0
glue_1.4.2 graphics_4.1.2 grDevices_4.1.2 highr_0.9 htmltools_0.5.2
jquerylib_0.1.4 jsonlite_1.7.2 knitr_1.36 magrittr_2.0.1 methods_4.1.2
rlang_0.4.12 rmarkdown_2.11 stats_4.1.2 stringi_1.7.5 stringr_1.4.0
tinytex_0.35 tools_4.1.2 utils_4.1.2 xfun_0.28 yaml_2.2.1