Fill=toself on scattergeo trace fills entire plot *except* polygon

I am trying to create a terrain map in plotly.js. It is going well except when I try to fill the polygons using fill=toself. Instead of filling the interior of the polygon, everything but the polygon is filled with the selected color.

I created a minimal repro with a single polygon. In the picture below I was expecting the square to be red vs. everything but the square. Is this expected and fill=toself is trying to solve other scenarios? It seems wrong but maybe I don’t understand what that does.

Example pic. Live page with is at - https://www.ifatc-test.org/plotly_test. All the relevant source code is in the page (vs. in other libraries, etc.).
image

Thanks,
Chris

FYI I did find this topic - Fill the inside of a Scattergeo polygon, not outside?.

Seems to describe the same behavior but I can’t glean any insight into how to solve my issue.

I did confirm that my polygon is closed (although the docs for fill=toself suggest plotly would close it anyway).

Thanks!

I’ve taken the live example down but this is still an open question for me.

The HTML example can be found here (as a text file):
https://1drv.ms/t/s!AmHRNdU2UxhEjOd6kuMsJKuEhPuEIA

Would still love input / a solution!

Thanks,
Chris

1 Like

I’m having the same problem with python plotly. I’ve found that certain polygons will fill correctly and others will not. For example coordinates lat=[10,20,20,10,10] and lon=[10,10,20,20,10] will fill the interior, while coordinates lat=[0,20,20,10,0] and lon=[0,10,20,20,0] will not.

Any suggestions?

Trevor

Try reversing the order of the lat and lon coordinate lists.

Created an account here just to say that reversing the order of lat and lon worked for me. Thanks for the suggestion, @aksharOza

1 Like