Skip to content

crosstalk html widget doesn't display the figure caption #1443

Open
@ThierryO

Description

@ThierryO

A chunk with a plot_ly() gets the correct caption as fixed in #118. However, the crosstalk version gets no caption.

Minimal example

--- 
title: "A Minimal Book Example"
author: "John Doe"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output:
  bookdown::gitbook: default
---

```{r crosstalk, fig.cap = "Missing caption"}
library(crosstalk)
library(plotly)
shared_mtcars <- SharedData$new(mtcars)
bscols(widths = 12,
  filter_slider("hp", "Horsepower", shared_mtcars, ~hp, width = "100%"),
  plot_ly(shared_mtcars, x = ~wt, y = ~mpg, color = ~factor(cyl)) |>
    add_markers()
)
```

```{r plotly, fig.cap = "Working caption"}
plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~factor(cyl)) |>
  add_markers()
```

Session info

R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS, RStudio 2023.12.0.99


Locale:
  LC_CTYPE=nl_BE.UTF-8       LC_NUMERIC=C               LC_TIME=nl_BE.UTF-8        LC_COLLATE=nl_BE.UTF-8    
  LC_MONETARY=nl_BE.UTF-8    LC_MESSAGES=nl_BE.UTF-8    LC_PAPER=nl_BE.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=nl_BE.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Brussels
tzcode source: system (glibc)

Package version:
  base64enc_0.1.3   bookdown_0.35     bslib_0.5.1       cachem_1.0.8      cli_3.6.1         digest_0.6.33    
  ellipsis_0.3.2    evaluate_0.22     fastmap_1.1.1     fontawesome_0.5.2 fs_1.6.3          glue_1.6.2       
  graphics_4.3.1    grDevices_4.3.1   highr_0.10        htmltools_0.5.6   jquerylib_0.1.4   jsonlite_1.8.7   
  knitr_1.44        lifecycle_1.0.3   magrittr_2.0.3    memoise_2.0.1     methods_4.3.1     mime_0.12        
  R6_2.5.1          rappdirs_0.3.3    rlang_1.1.1       rmarkdown_2.25    sass_0.4.7        stats_4.3.1      
  stringi_1.7.12    stringr_1.5.0     tinytex_0.47      tools_4.3.1       utils_4.3.1       vctrs_0.6.3      
  xfun_0.40         yaml_2.3.7  

Metadata

Metadata

Assignees

Labels

featurea feature request or enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions