plotly / plotly/plotly.R

ggplotly() doesn't support multiple colors in axis ticks

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

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

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

説明

Hello and thanks for the great job you did by making this really useful package. I just want to report an issue that appears when I need to colour the axis text of a plot with pre - defined colours. Below you can see the R code to build a really simple shiny app. If I plot my graph with the standard ggplot() function the names of the x axis result colored, but if I use the function ggplotly() to make my plot interactive, the text of the x axis remains black (the functions recognizes the arguments "angle" and "hjust" but not "col").

Thanks in advance for the availability.

Nico

library(ggplot2)
library(plotly)
library(shiny)

### UI
ui <- fluidPage(
  fluidRow(
    column(width = 8,
           plotlyOutput(outputId = "plot", 
                        height = "600px"))))

### SERVER
server <- function(input, output) {
  
output$plot <- renderPlotly({
  
  mpg_s <- mpg[c(1, 19, 38), ] # subset to pick just 3 rows
  
  col <- c("red", "green", "blue")
  
  p <- ggplot(data = mpg_s,
              aes(x = manufacturer, y = hwy)) +
         geom_point() +
         theme(axis.text.x = element_text(size = 20,
                                         angle = 90,
                                         hjust = 1,
                                         colour = col))
  
  ggplotly(p)

  })
}

### LUNCH APP
shinyApp(ui = ui, server = server)

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

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

はじめの一歩

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

調査の方向性

この issue には Shiny アプリでの再現可能な ggplotly(p) の例がありますが、リポジトリのファイルやテストは記載されていません。まず、ggplotly が ggplot2 の axis.text.x 設定をどのように変換するかを追跡し、次に ggplot の出力とインタラクティブな出力を比較します。インタラクティブな x 軸の目盛りラベルに定義済みの色が表示されれば完了です。

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

評価

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

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

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