我正在尝试在分散地图框中将“自然痕迹”的线条样式更改为破折号。但是,根据文档,这是没有选择的,因为line
仅接受具有dict
和width
属性的color
。有没有解决的办法?
当前绘制一条实线:_____________
尝试绘制虚线:------------
ValueError:为plotly.graph_objs.scattermapbox.Line类型的对象指定了无效的属性。Line:“破折号”
import plotly.graph_objects as go
fig = go.Figure(
data=[
go.Scattermapbox(
name='Railroad',
hoverinfo='name',
lat=fcrl_lats,
lon=fcrl_lons,
mode="lines",
line=dict(width=2, color="#ff4931")
),
go.Scattermapbox(
name='Bike Lanes',
hoverinfo='name',
lat=hcbl_lats,
lon=hcbl_lons,
mode="lines",
line=dict(width=2, color="#006699")
),
go.Scattermapbox(
name='Natural Trails',
hoverinfo='name',
lat=nat_lats,
lon=nat_lons,
mode="lines",
line=dict(dash='dash', width=1, color="#38ad74")
)
]
)
fig.update_layout(
showlegend=True,
legend=mapLegend,
margin={"r":0,"t":0,"l":0,"b":0},
mapbox=go.layout.Mapbox(
style="carto-positron",
zoom=12,
center_lat = 40.55,
center_lon = -105.08,
)
)
fig.show()