试图在plotly中找到可用的不同类型项目的列表
不同样本的投影类型:
projection = list(type = "equirectangular")
projection = list(type = 'azimuthal equal area'),
projection = dict(type = 'Mercator')
Run Code Online (Sandbox Code Playgroud)
任何在线文档都会有所帮助
Ken*_*dal 10
以下是世界预测的更全面的列表:
这个github显示了不同的投影:http: //etpinard.github.io/plotly-dashboards/map-projections/
一个地图投影的名单(有图片)可在维基百科.
2021年答案:
此代码将向您显示所有可能的投影(除了transverse mercator不适用于此示例数据的投影,但当我使用不同的数据进行测试时它可以工作)。
地图图表将保存到./projections/文件夹中。
投影列表来源:https://plotly.com/python/map-configuration/#map-projections
import plotly.express as px
from pathlib import Path
df = px.data.election()
geojson = px.data.election_geojson()
fig = px.choropleth(df, geojson=geojson, color="Bergeron",
locations="district", featureidkey="properties.district")
fig.update_layout(margin={"r":10,"t":50,"l":10,"b":10})
fig.update_geos(fitbounds='locations', resolution=50,scope='north america')
projections = ['equirectangular', 'mercator', 'orthographic', 'natural earth',
'kavrayskiy7', 'miller', 'robinson', 'eckert4', 'azimuthal equal area',
'azimuthal equidistant', 'conic equal area', 'conic conformal',
'conic equidistant', 'gnomonic', 'stereographic', 'mollweide', 'hammer',
'transverse mercator', 'albers usa', 'winkel tripel', 'aitoff', 'sinusoidal']
Path('./projections/').mkdir(parents=True, exist_ok=True)
for p in projections:
fig.update_geos(projection_type=p)
fig.update_layout(title=p)
path=f'./projections/{p}.png'
fig.write_image(file=path,width=960,height=540,scale=2)
Run Code Online (Sandbox Code Playgroud)