Maintaining Google Font when converting ggplot figure to plotly

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.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.