简体   繁体   English

如何从 plotly Scattergeo 跟踪中删除状态?

[英]how to remove states from plotly Scattergeo trace?

I was reading through the Scattergeo documentation to remove Alaska and Hawaii from the 'usa' scoped without success.我正在阅读 Scattergeo 文档,以将阿拉斯加和夏威夷从“美国”范围内删除,但没有成功。 No functionality to access a specific subunit.没有访问特定子单元的功能。 Is there any workaround to perform this?是否有任何解决方法来执行此操作?

在此处输入图像描述

Ok, so this solved my issue.好的,所以这解决了我的问题。 I had to superimpose a new trace.我不得不叠加一个新的痕迹。 Take into account that the marker_line_color has to be set equal to your paper_bgcolor , once you got this, in order to avoid some aliasing between the Cholorpleth and the Scattergeo , set the marker_line_width to something bigger than the default value, eg 2.考虑到marker_line_color必须设置为等于您的paper_bgcolor ,一旦你得到这个,为了避免CholorplethScattergeo之间的一些混叠,将marker_line_width设置为大于默认值的值,例如 2。

chorpleth = go.Choropleth(
        locationmode='USA-states',
        z=[0,0],
        locations=['AK','HI'],
        colorscale = [[0,'rgba(0, 0, 0, 0)'],[0,'rgba(0, 0, 0, 0)']],
        marker_line_color='#fafafa',
        marker_line_width=2,
        showscale = False,
    )

fig.add_trace(chorpleth, row=1, col=1) 

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM