Hello, I'm trying to figure out how to maintain Google Font used in a ggplot figure when converting the figure to a plotly object. Here is my code:
library(ggplot2)
library(plotly)
library(tidyverse)
library(showtext)
library(sysfonts)
font_add_google("Open Sans", "open")
showtext_auto()
data <- iris
barChart <-
data %>% ggplot(aes(
x = Sepal.Width,
y = Sepal.Length,
fill = Species,
)) + geom_bar(stat = "identity") +
theme_gray(base_family = "open")
p <- ggplotly(barChart)
The font does not persist once the figure is converted to plotly object. TIA for any help or suggestions.