Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
awulkiew opened this issue Nov 26, 2021 · 0 comments

Comments

@awulkiew
Copy link

awulkiew commented Nov 26, 2021

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant