Hello ggplot-pros!
I am trying to produce a plot using ggplot
, ggtext
, and ggiraph
in a distill blog post. It's an interactive plot with one word in the plot title in color.
The code below works fine as long as I look at the produced graph on a larger screen (laptop is ok). When I look at it on a mobile device, the letters are overlapping. Would be great if someone here has an idea.
I tried to isolate the problem and put it online here:
I had also put on a related question on SO and Stack, but to no avail (will post answer here if one comes up). I also have filed an issue at Github, but I haven't heard back for a while. Any idea? Many thanks
{r}
library(ggtext)
library(ggiraph)
library(tidyverse)
my_plot <- mtcars %>%
ggplot()+
labs(title=glue::glue("this is a very long title, with many lines and a line <br>break etc etc etc, this <br>word is in <span style='color:red;'>red</span> or something else etc etc"))+
geom_point_interactive(aes(x=wt,
y=qsec,
tooltip=paste(wt, qsec)))+
theme(plot.title=element_markdown())
girafe(ggobj = my_plot,
fonts=list(sans="Roboto Condensed"),
height_svg = 5,
options = list(
opts_toolbar(saveaspng = FALSE))
)
Screenshot from laptop:
Screenshot from mobile device: