plotly / plotly/plotly.js

Wrong layout when adjusting gap between positive-side violin plots.

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

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

bug P3
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
28

説明

When showing two violin plots in the same graph, it is possible to control the size of the gap between them. If changing the plots to show only the positive side, this breaks (the top graph is placed in the wrong location and is clipped).

This works:

<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id=id-1 class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script src="https://cdn.plot.ly/plotly-2.3.0.min.js"></script>
<script type="text/javascript">
window.PlotlyConfig = {MathJaxConfig: 'local'};
window.PLOTLYENV = window.PLOTLYENV || {}
if (document.getElementById('id-1')) {
    Plotly.newPlot(
        'id-1',
        [{
                "boxpoints": false,
                "type": "violin",
                "name": "Trace 1",
                "points": false,
                "box": {
                    "visible": false
                },
                "legendgroup": "Trace 1",
                "x": [0.75, 5.25, 5.5, 6.0, 6.2, 6.6, 6.8, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15, 8.15, 8.65, 8.93, 9.2, 9.5, 10.0, 10.25, 11.5, 12.0, 16.0, 20.9, 22.3, 23.25]
            },
            {
                "boxpoints": false,
                "type": "violin",
                "name": "Trace 2",
                "points": false,
                "box": {
                    "visible": false
                },
                "legendgroup": "Trace 2",
                "x": [7.9, 5.4, 7.4, 6.2, 8.5, 5.5, 8.8, 8.5, 5.1, 8.5, 5.4, 8.4, 7.8, 4.7, 8.3, 5.2, 6.2, 8.4, 5.2, 7.9, 5.1, 4.7, 7.8, 6.9, 7.4, 8.3, 5.5, 7.6, 7.8, 7.9, 7.3, 7.7, 6.6, 8.0, 7.4, 5.2, 4.8, 8.0, 5.9, 9.0, 8.0, 5.8, 8.4, 5.8, 7.3, 8.3, 6.4, 5.3, 8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7.3, 8.8, 8.0, 7.1, 8.3, 5.6, 7.9, 7.8, 8.4, 5.8, 8.3, 4.3, 6.0, 7.5, 8.1, 4.6, 9.0, 4.6, 7.4, 14.0, 15.0]
            }
        ], {
            "showlegend": false,
            "xaxis": {
                "showgrid": true,
                "gridcolor": "lightgrey",
                "showticklabels": true,
                "range": [0.75, 23.25]
            },
            "boxgroupgap": 0,
            "violingap": 0.1,
            "template": "simple_white",
            "boxgap": 0.1,
            "legend": {
                "tracegroupgap": 0,
                "itemdoubleclick": false
            },
            "yaxis": {
                "showgrid": false,
                "gridcolor": "lightgrey",
                "showticklabels": false,
                "range": [null, null]
            },
            "violingroupgap": 0,
            "margin": {
                "l": 50,
                "b": 50,
                "r": 50,
                "t": 50
            }
        }, {
            "editable": false,
            "responsive": true,
            "staticPlot": false,
            "scrollZoom": true
        },
    )
}
</script>
</body>
</html>

It shows:

Image

This fails (the only difference is adding "side":"positive", to the traces):

<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id=id-1 class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script src="https://cdn.plot.ly/plotly-2.3.0.min.js"></script>
<script type="text/javascript">
window.PlotlyConfig = {MathJaxConfig: 'local'};
window.PLOTLYENV = window.PLOTLYENV || {}
if (document.getElementById('id-1')) {
    Plotly.newPlot(
        'id-1',
        [{
                "side":"positive",
                "boxpoints": false,
                "type": "violin",
                "name": "Trace 1",
                "points": false,
                "box": {
                    "visible": false
                },
                "legendgroup": "Trace 1",
                "x": [0.75, 5.25, 5.5, 6.0, 6.2, 6.6, 6.8, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15, 8.15, 8.65, 8.93, 9.2, 9.5, 10.0, 10.25, 11.5, 12.0, 16.0, 20.9, 22.3, 23.25]
            },
            {
                "side":"positive",
                "boxpoints": false,
                "type": "violin",
                "name": "Trace 2",
                "points": false,
                "box":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5.1, 7.8, 6.0, 8.2, 9.1, 5.3, 7.8, 4.6, 7.7, 8.4, 4.9, 8.3, 7.1, 8.0, 4.9, 7.5, 6.4, 7.6, 5.3, 9.4, 5.5, 7.6, 5.0, 8.2, 5.4, 7.5, 7.8, 7.9, 7.8, 7.8, 7.0, 7.9, 7.0, 5.4, 8.6, 5.0, 9.0, 5.4, 5.4, 7.7, 7.9, 6.4, 7.5, 4.7, 8.6, 6.3, 8.5, 8.2, 5.7, 8.2, 6.7, 7.4, 5.4, 8.3, 7.3, 7.3, 8.8, 8.0, 7.1, 8.3, 5.6, 7.9, 7.8, 8.4, 5.8, 8.3, 4.3, 6.0, 7.5, 8.1, 4.6, 9.0, 4.6, 7.4, 14.0, 15.0]
            }
        ], {
            "showlegend": false,
            "xaxis": {
                "showgrid": true,
                "gridcolor": "lightgrey",
                "showticklabels": true,
                "range": [0.75, 23.25]
            },
            "boxgroupgap": 0,
            "violingap": 0.1,
            "template": "simple_white",
            "boxgap": 0.1,
            "legend": {
                "tracegroupgap": 0,
                "itemdoubleclick": false
            },
            "yaxis": {
                "showgrid": false,
                "gridcolor": "lightgrey",
                "showticklabels": false,
                "range": [null, null]
            },
            "violingroupgap": 0,
            "margin": {
                "l": 50,
                "b": 50,
                "r": 50,
                "t": 50
            }
        }, {
            "editable": false,
            "responsive": true,
            "staticPlot": false,
            "scrollZoom": true
        },
    )
}
</script>
</body>
</html>

It shows:

Image

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

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

はじめの一歩

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

調査の方向性

まず、提供された2つのHTML例をPlotly 2.3.0で再現し、通常のバイオリンプロットのレイアウトと、side="positive"およびゼロ以外のviolingapを使用するtraceのレイアウトを比較します。上側のグラフが誤った位置に配置され、クリップされる理由を特定するために、バイオリンプロットのレイアウト経路を追跡します。完了条件は、正の側のプロットが要求された間隔を維持し、両方のグラフが正しい位置に描画されることです。

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

評価

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

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

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