[BUG]: Automargin for quiver plots is a little off with `arrowref: 'paper'`
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript
調査の方向性
src/traces/quiver/calc.js の 200-206 行付近から始め、arrowref を paper に設定して、提供された quiver の図を再現します。矢印の終点と automargin の範囲が、軸のスケールに対してどのように計算されるかを追跡します。データのアスペクト比が 1:1 から大きく異なる場合も含め、初期のプロット領域にすべての矢印の終点が含まれれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Desired behavior
Quiver automargin should always result in an initial plot area which contains all arrow endpoints.
Current behavior
The current quiver implementation calculates the arrow endpoints assuming arrowref: 'data', uses those endpoints to compute the automargin extents, and then if arrowref is 'paper'`, applies an adjustment factor to the arrow endpoints.
If the x:y aspect ratio of the data is pretty close to 1:1, this works OK because the arrow endpoints don't change much. But if the aspect ratio of the data is very far from 1:1, this can result in an initial plot where the arrow endpoints extend outside of the plotted area.
Example
Figure definition:
{
"data": [
{
"type": "quiver",
"uhoverformat": ".3f",
"yhoverformat": ".3f",
"xhoverfomrat": ".3f",
"vhoverformat": ".3f",
"x": [0],
"y": [0],
"u": [1],
"v": [0.1],
"arrowref": "paper"
}
],
"layout": {
"width": 800,
"height": 600,
"showlegend": false
}
}
Screenshot:
Notice how the tip of the arrow extends off the right side of the plot.
Fix
The relevant logic is around lines 200-206 in src/traces/quiver/calc.js.
It's a bit of a chicken-and-egg problem, because when arrowref is 'paper', the data position of the arrow endpoints depends on the axis scales, which depend on the position of the arrow endpoints. I think there is probably an algebraic solution but haven't quite been able to figure it out. Alternatively there's probably an iterative or approximate approach we could apply here that would still be an improvement over the current behavior.
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 30
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/plotly.js のほかの issue
-
chore P3 plotly-internal size: 3 task
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
-
bug P2 size: 1
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
chore P1 plotly-internal size: 1 task
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
chore P3 plotly-internal size: 1 task
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
plotly/plotly.js の issue をすべて見る
似ている issue
-
ai-observability bug team/ai-observability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AllTheMods/ATM-10-L#19 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SignalK/n2k-signalk#345 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
JuliaPluto/PlutoPlotly.jl#72 ·