plotly / plotly/plotly.R

error_x ignores user provided value; defaults to 10 always

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

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

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

説明

Using the example for coef plots here, I find that no matter what values are provided o error_x = ~ ... , the plot always shows error bars at 10% of the point-estimate.


Brief description of the problem

library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
library(ggplot2)

fit <- lm(mpg ~ cyl + disp + wt, mtcars)
summary(fit)
#> 
#> Call:
#> lm(formula = mpg ~ cyl + disp + wt, data = mtcars)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -4.4035 -1.4028 -0.4955  1.3387  6.0722 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) 41.107678   2.842426  14.462 1.62e-14 ***
#> cyl         -1.784944   0.607110  -2.940  0.00651 ** 
#> disp         0.007473   0.011845   0.631  0.53322    
#> wt          -3.635677   1.040138  -3.495  0.00160 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 2.595 on 28 degrees of freedom
#> Multiple R-squared:  0.8326, Adjusted R-squared:  0.8147 
#> F-statistic: 46.42 on 3 and 28 DF,  p-value: 5.399e-11

# Plots Don't Agree. Plotly shows incoprrect error bars
goodplot <- GGally::ggcoef(fit, sort = "ascending")
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
badplot <- fit %>% broom::tidy() %>%
        mutate(term = forcats::fct_reorder(term, estimate)) %>%
        plot_ly(x = ~ estimate, y = ~ term) %>%
        add_markers(
                error_x = ~ list(value = std.error),
                color = I("black"),
                hoverinfo = "x"
        )

Created on 2020-03-02 by the reprex package (v0.3.0)

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

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

はじめの一歩

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

調査の方向性

reprex の add_markers() 呼び出しと、その error_x = ~ list(value = std.error) マッピングから始め、R インターフェースがユーザー指定のエラーバー値をどのように処理するかを追跡します。mtcars モデルを使ってプロットを再現し、デフォルトの 10% 値ではなく、指定した標準誤差が描画されることを確認します。

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

評価

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

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

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