Closed cboettig closed 2 years ago
Thanks, I can't seem to replicate this message, do you have a {reprex}
to share?
Thanks, this should do it:
library(thematic)
thematic::thematic_rmd(font = "auto")
library(ggplot2)
library(ggiraph)
library(data.table)
library(charlatan)
species <- ch_taxonomic_species(n = 10)
dat <- lapply(species, function(species, n){
data.table(
date = as.Date(seq_len(n), origin = "2018-10-25"),
sales = cumsum(runif(n, -1, 1)),
species = species,
name = ch_name(n = n)
)
}, n = 200)
dat <- rbindlist(dat)
gg <- ggplot(dat, aes(x = date, y = sales,
colour = species, group = species)) +
geom_line_interactive(aes(tooltip = name, data_id = species)) +
scale_color_viridis_d() +
labs(title = "move mouse over lines")
x <- girafe(ggobj = gg, width_svg = 8, height_svg = 6,
options = list(
opts_hover_inv(css = "opacity:0.1;"),
opts_hover(css = "stroke-width:2;")
))
x
For some reason, running this within reprex()
actually just crashes R for me, but the above should reproduce it. Also attaching a reprex Rmd . (This example is taken from the docs at https://davidgohel.github.io/ggiraph/articles/offcran/examples.html)
Here's my sessionInfo:
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS
Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] thematic_0.1.2.1 charlatan_0.4.0 data.table_1.14.2 patchwork_1.1.1
[5] ggiraph_0.7.10 ggplot2_3.3.5 flexdashboard_0.5.2.9000
loaded via a namespace (and not attached):
[1] tidyselect_1.1.1 xfun_0.26 bslib_0.3.1 purrr_0.3.4 lattice_0.20-45 colorspace_2.0-2
[7] vctrs_0.3.8 generics_0.1.0 viridisLite_0.4.0 htmltools_0.5.2 yaml_2.2.1 utf8_1.2.2
[13] rlang_0.4.11 pillar_1.6.3 jquerylib_0.1.4 glue_1.4.2 withr_2.4.2 DBI_1.1.1
[19] uuid_0.1-4 lifecycle_1.0.1 munsell_0.5.0 gtable_0.3.0 htmlwidgets_1.5.4 evaluate_0.14
[25] labeling_0.4.2 knitr_1.36 fastmap_1.1.0 fansi_0.5.0 Rcpp_1.0.7 renv_0.14.0
[31] scales_1.1.1 jsonlite_1.7.2 farver_2.1.0 systemfonts_1.0.2 digest_0.6.28 dplyr_1.0.7
[37] grid_4.1.0 cli_3.0.1 tools_4.1.0 magrittr_2.0.1 sass_0.4.0.9000 tibble_3.1.5
[43] whisker_0.4 crayon_1.4.1 pkgconfig_2.0.3 ellipsis_0.3.2 rsconnect_0.8.24 assertthat_0.2.1
[49] rmarkdown_2.11 rstudioapi_0.13 R6_2.5.1 compiler_4.1.0
:tada: amazing!
Thanks for an amazing package! RStudio's work never fails to impress, but it's been a while since anything has felt quite so magical as
thematic
! :exploding_head:ggiraph is an excellent and widely used package for generating interactive plots for webpages and dashboards. It is somewhat similar to
plotly
, able to generate javascript-based interactions as htmlwidget objects, but more tailored to the grammar of graphics. Using ggiraph with thematic generates the warning:(though it actually looks like the theme is still applied anyway?)
It would be just wonderful to have
ggiraph
'sdsvg_device
supported.