Can not use my custom font with plotly
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den gemeldeten Unterschied zwischen dem showtext/font.add-Setup in ggplot und dem Beispiel ggplotly(p) %>% layout(font=t). Beginne bei den Einstiegspunkten ggplotly und layout(font=t) und untersuche, wie die benutzerdefinierte Familie an das gerenderte Diagramm übergeben wird. Als erledigt gilt die Aufgabe, wenn die Schriftart Proxima Nova in der Plotly-Ausgabe gerendert wird und es eine Regressionsprüfung für das Beispiel gibt, falls das Projekt einen geeigneten Testort hat.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- plotly, r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100