Skip to main content
 首页 » 编程设计

python之Plotly地理映射,设置locationmode ="IN"

2025年05月04日8cyq1162

就像 Geographical Plotting 中有一个 'USA-states' 作为定位模式一样,印度有什么东西吗?

data = dict(type = 'choropleth', 
        locations = ['AZ','CA','NY'], 
        locationmode = 'USA-states', 
        colorscale= 'Portland', 
        text= ['text1','text2','text3'], 
        z=[1.0,2.0,3.0], 
        colorbar = {'title':'Colorbar Title'}) 

请您参考如下方法:

在做了一些研究后,我也在 soln 中搜索相同的问题,我发现在 locationmode 中只能传递三个列出的参数中的一个,即 1.'ISO-3'(默认情况下)2.'USA- states' 3.'country names'。但是你可以使用 layout = dict(geo={'scope':'asia'}) 查看印度 map 。这里有一个链接 https://plot.ly/python/reference/#choropleth-locationmode