plotly / plotly/plotly.R

Can not use my custom font with plotly

オープン
#2,117 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

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)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ggplot の showtext/font.add 設定と ggplotly(p) %>% layout(font=t) の例との間で報告されている差異を再現します。ggplotly と layout(font=t) のエントリポイントから始め、カスタムファミリーがレンダリングされるチャートにどのように渡されるかを調査します。Plotly 出力で Proxima Nova フォントがレンダリングされ、プロジェクトに適切なテスト場所がある場合は、この例のリグレッションチェックも行われれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
plotly, r
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。