Can not use my custom font with plotly
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I am trying to use a custom font with plotly but it does not work althoug it does work with ggplot. Is there a way to solve this?
You can download the font here: https://freefontsfamily.com/proxima-nova-font-family-free-download/
This is the ggplot example that does work:
library(dplyr)
library(ggplot2)
library(plotly)
library(showtext)
font.add("Proxima Nova", "ProximaNova.otf")
df <- data.frame(x = c(1,2,3), y = c(2,3,4))
my_theme_ggplot <-
ggplot2::theme_bw() +
ggplot2::theme(
plot.title = element_text(hjust = 0.5),
text=element_text(size=16, family="Proxima Nova")
)
p <- df %>% ggplot(aes(x = x, y = y)) +
geom_line() +
ggtitle("Title", ) +
labs(y= "Date", x = "Y Data") +
my_theme_ggplot
p
This is the plotly example that does not work
df <- data.frame(x = c(1,2,3), y = c(2,3,4))
t <- list(
family = "Proxima Nova",
size = 14)
p <- df %>% ggplot(aes(x = x, y = y)) +
geom_line() +
ggtitle("Title", ) +
labs(y= "Date", x = "Y Data")
ggplotly(p) %>% layout(font=t)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez la différence signalée entre la configuration showtext/font.add dans ggplot et l’exemple ggplotly(p) %>% layout(font=t). Commencez par les points d’entrée ggplotly et layout(font=t), puis examinez comment la famille personnalisée est transmise au graphique rendu. Le travail est terminé lorsque la police Proxima Nova est rendue dans la sortie Plotly, avec une vérification de régression pour l’exemple si le projet dispose d’un emplacement de test approprié.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- plotly, r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100