plotly / plotly/plotly.R

ggplotly date shows wrong when use geom_bar(stat='count')

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

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

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

説明

I find a problem that, when I use geom_bar(stat='count') to draw a plot and convert to plotly, when pointing to, the label shows date an integer, but when I aggregate the data first and use geom_bar(stat='identity'), the label shows date in proper format. The issue happened after I update to MRO 3.4.1, and try to solve the problem that ggplotly makes graph empty when x axis is date. I update both ggplot2 and plotly to github version that empty problem is gone, but new problem comes.

By the way. Is there a method that control the date format in the label?

devtools::install_github("hadley/ggplot2")
devtools::install_github("ropensci/plotly") 
library(ggplot2) 
library(plotly) 

df2 = data.frame(time = c('2017-01-01 06:00:23', '2017-01-01 10:00:23', 
                          '2017-01-01 18:00:23', '2017-01-01 24:00:23', 
                          '2017-01-02 06:00:23', '2017-01-02 10:00:23', 
                          '2017-01-02 18:00:23', '2017-01-03 24:00:23'), 
                 y = c(1:8)) 

df2.p = ggplot(df2 %>% mutate(date_id = as.Date(time)), aes(x = date_id, y = ..count..)) + 
  geom_bar(stat = 'count') 

ggplotly(df2.p) 

df3 = df2 %>% mutate(date_id = as.Date(time)) %>% 
  group_by(date_id) %>% summarise(
    count = n() 
  ) 
df3.p = ggplot(df3, aes(x = date_id, y = count)) + 
  geom_bar(stat = 'identity') 
ggplotly(df3.p) 
plotly_date_issue plotly

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

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

はじめの一歩

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

調査の方向性

issue にある再現可能な R の例から始め、geom_bar(stat='count') の ggplotly 出力を stat='identity' 版と比較します。各変換で date_id の aesthetic がどのように表現されるかを調査します。完了の条件は、カウントベースのバーに適切にフォーマットされた日付ラベルが表示され、日付フォーマットに関する挙動が明確になっていることです。

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

評価

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

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

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