Legend size for scatter plot

Hi,
I made a few scatter plots and wanted to draw a legend where the size of the markers is related to some data. It seems that the legend height is limited since the markers are overlapping. I tried to use the tracegroupgap without success.
Thanks for your help.

For each of your traces you need to create a unique legendgroup. tracegroup gap will put spaces between these legendgroups.

{
"data": [
 { 
            "type": "scatter",
            "x": [
                1,
                2,
                3
            ],
            "y": [
                2,
                1,
                2
            ],
            "legendgroup": "group"
        },
        {
            "type": "box",
            "x": [
                1,
                2,
                3
            ],
            "y": [
                1,
                2,
                1
            ],
            "legendgroup": "group1"
        }
    ],
    "layout": {
        "legend": {
            "tracegroupgap": 20
         }
    }
}
1 Like