plotly / plotly/plotly.R

Adding logo to a plot using `layout` doesn't work with local images.

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

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

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

説明

It appears that if you add a logo to a plotly figure using the layout function, it only works when using a remotely hosted image. Using the example on the logo tutorial, the logo is added to the plot if you point to a remote url, but not if you point to a local image:

library(plotly)

# photo used in Plotly logo example page
url <- "https://images.plot.ly/language-icons/api-home/python-logo.png"
download.file(url, "./python-logo.png")

fig <- plot_ly(x = c(1, 2, 3), y = c(1, 2, 3))
fig <- fig %>% add_lines() 
this_works <- fig %>%
  layout(
    images = list(
      list(source = url,
           xref = "paper",
           yref = "paper",
           x= 0,
           y= 1,
           sizex = 0.2,
           sizey = 0.2,
           opacity = 0.8
      )
    )
  )

this_doesnt <- fig %>%
  layout(
    images = list(
      list(source = "./python-logo.png",
           xref = "paper",
           yref = "paper",
           x= 0,
           y= 1,
           sizex = 0.2,
           sizey = 0.2,
           opacity = 0.8
      )
    )
  )

Created on 2023-05-23 with reprex v2.0.2

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

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

はじめの一歩

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

調査の方向性

issue に示されているエントリポイント layout(images = ...) から始め、リモート URL とローカル画像ソースがどのように扱われているかを比較します。ダウンロードした python-logo.png で例を再現し、リモート画像と同じようにローカル画像が plot に表示されれば完了です。

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

評価

技術スタック
r
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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