Skip to content

Polygons with holes doesn't work with scattergeo, fill: 'toself' seems to be ignored. #6044

Closed
@awulkiew

Description

@awulkiew

If polygon is defined as multiple rings in one trace, with scattergeo the relation of the rings seems to be ignored even if fill is set to toself. Such polygon is treated as multipolygon and each ring is drawn WRT the whole globe. Projection type is irrelevant. The behavior is different and correct in the case of scatter plot.

Polygon without hole:
polygon without hole

Polygon with hole:
polygon with hole

Polygon with hole 2:
polygon with hole 2

To reproduce:

<http>
<head>
    <script src="https://cdn.plot.ly/plotly-latest.js"></script>
</head>
<body>
    <div id="plot"></div>
    <script>
        var plot = document.getElementById('plot');

        var layout = {
            geo: {
                bgcolor: '#fff',
                projection: {
                    type: 'orthographic',
                    rotation: {
                        lon: 45,
                        lat: 10
                    },
                },
                showocean: true,
                oceancolor: '#fff',
                showland: true,
                landcolor: '#fff',
                showlakes: false,
                lakecolor: '#fff',
                showcountries: true,
                lonaxis: {
                    showgrid: true,
                    gridcolor: '#555'
                },
                lataxis: {
                    showgrid: true,
                    gridcolor: '#555'
                }
            }
        };

        var traces = [{
            lon: [1,1,90,90,1,null,10,20,20,10,10],
            lat: [1,27,27,1,1,null,10,10,20,20,10],
            mode: 'lines+markers',
            type: 'scattergeo',
            fill: 'toself',
            fillcolor: '#f555',
            marker: {color: '#f55a'},
            line: {color: '#f55a'}
        }];

        Plotly.newPlot(plot, traces, layout);
    </script>
</body>
</http>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions