Plotly/ggplotly Custom font family does not work 2

Hello, I am having this exact problem. I can import my own otf font and use it with ggplot2 but when I turn that ggplot into a plotly my custom font disapears and it is replaced with a default font. Is there a way to fix this? Thanks in advanced!

I couldn't find the solution.

Check out this video,
This guy is great in general.
I put the timeline where you might find an answer

Thank you @RYann that solved it! . Here is a minimal working example.
you can download the font here Proxima Nova Font Free Download


library(dplyr)
library(ggplot2)
library(plotly)
library(showtext)

font_add(family = "Proxima Nova", "ProximaNova.otf")

showtext_auto()
df <- data.frame(x = c(1,2,3), y = c(2,3,4))


df <- data.frame(x = c(1,2,3), y = c(2,3,4))


t <- list(
  family = "Proxima Nova",
  size = 14)

hit <- df %>% ggplot(aes(x = x, y = y)) + 
  geom_line() +
  ggtitle("Title", ) +
  labs(y= "Date", x = "Y Data") 

ggplotly(hit) #%>% plotly::layout(font=t)
1 Like

@EkremBayar check the reply above. That solved it. For some reason after using font_add you no longer need plotly::layout. If you use layout then it won't work

1 Like

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.