在 ggiraph 0.7 (R) 中设置工具提示字体

问题描述

这很可能是一个 CSS 查询而不是一个 {ggiraph} 问题,或者可能与我的 R 或 Cairo 安装有关,但这里是:

我正在构建一个 ggiraph 交互式绘图,但我为工具提示选项应用的设置并未应用于打印的绘图。

这是一个reprex:

library(tidyverse)
library(ggiraph)
test_df <- tibble::tribble(
  ~Index,~This,~That,~Something.Else,1L,20L,57L,"A",2L,22L,58L,"B",3L,24L,65L,4L,26L,68L,5L,28L,89L,6L,30L,93L,7L,32L,97L,8L,34L,101L,9L,36L,105L,10L,38L,109L,11L,40L,72L,12L,42L,76L,13L,44L,80L,14L,46L,84L,"A"
  )

plot <- ggplot(test_df,aes(x = This,y= That,colour = Something.Else))+
  geom_point_interactive(alpha = 0.8,aes(tooltip = That,data_id= Index))
 

tooltip_css <- "background-colour:transparent;font-family: Arial,Helvetica,sans-serif;"
ploti <- girafe(ggobj = plot,fonts = list(sans = "Helvetica"),options = c(opts_sizing(width = 0.7)),opts_tooltip(css = tooltip_css))

print(ploti)

您可以在此处查看交互式结果:https://rpubs.com/arf/718801

但我遇到的问题是,尽管将 font-family 设置为 sans-serif 字体,但工具提示使用的是不同的字体,并且忽略了背景颜色设置。我做错了什么?

Example of tooltip font and background

背景:我使用的是 RStudio 1.4.1103

R.version _
平台 x86_64-apple-darwin17.0
拱形 x86_64
操作系统 darwin17.0
系统 x86_64,darwin17.0
状态
大四
次要 0.2
2020年
06月
第22天
SVN 修订版 78730
语言R
version.string R 版本 4.0.2 (2020-06-22) 昵称再次起飞

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)