plotly / plotly/plotly.R

Wrong width of bar in bar plots

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

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

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

説明

I would have expected a single bar with a width of 0.05 here:

library(plotly)

plot_ly(
  type = 'bar',
  x = 0.2,
  y = 10,
  width = 0.05
) %>% 
layout(
  xaxis=list(range=c(0,1))
)

Instead, I get a single bar with width 0.6 (and not 0.05).

Similarily, I would have expected two bars, each of width 0.05 here:

plot_ly(
  type = 'bar',
  x = c(0.2, 0.5),
  y = c(10, 8),
  width = 0.05
) %>% 
layout(
  xaxis=list(range=c(0,1))
)

Instead, it shows two bars, but not of width 0.05.

Only if I'm plotting 4 bars (or more) do I get the correct width (of 0.05) for each:

plot_ly(
  type = 'bar',
  x = c(0.2, 0.5, 0.6, 0.7),
  y = c(10, 8, 7, 3),
  width = 0.05
) %>% 
layout(
  xaxis=list(range=c(0,1))
)

Checking with a Javascript codepen, using

var trace0 = {
  type: 'bar',
  x: [0.2],
  y: [10],
  width: 0.05
}

var layout = {
  xaxis: {range: [0, 1]}
}

var data = [trace0]

Plotly.newPlot('myDiv', data, layout);

does give the expected result.

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

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

はじめの一歩

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

調査の方向性

まず、plot_ly() と layout() を使って 3 つの R の例を再現し、その後、それらの棒の幅を JavaScript CodePen の例と比較します。R の入力が棒グラフのエントリーポイントにどのように変換されるかを追跡します。4 本の棒のグラフおよび JavaScript の例と同様に、1 本および 2 本の棒のグラフが width = 0.05 を尊重すれば完了です。

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

評価

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

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

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