我正在使用 hvplot 进行流表示。到目前为止,查看文档,我还没有找到指导线路的方法。我正在使用线表示,如您在下面的代码中所见
flowDs = pd.DataFrame([
{'id':0,'origin':Point(-44.6077,-19.8601), 'timeOrigin':datetime(2018,1,1,12,0,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,6,0),'inflow':45,'outflow':30,},
{'id':1,'origin':Point(-46.6388,-23.5489), 'timeOrigin':datetime(2018,1,1,12,6,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,10,0),'inflow':60,'outflow':20,},
{'id':2,'origin':Point(-47.9292,-15.7801), 'timeOrigin':datetime(2018,1,1,12,10,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,15,0),'inflow':15,'outflow':30,},
{'id':3,'origin':Point(-43.2096,-22.9035), 'timeOrigin':datetime(2018,1,1,12,15,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,20,0),'inflow':20,'outflow':40,},
{'id':4,'origin':Point(-44.6077,-19.8601), 'timeOrigin':datetime(2018,1,2,12,0,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,6,0),'inflow':45,'outflow':30,},
{'id':5,'origin':Point(-46.6388,-23.5489), 'timeOrigin':datetime(2018,1,2,12,6,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,10,0),'inflow':60,'outflow':20,},
{'id':6,'origin':Point(-47.9292,-15.7801), 'timeOrigin':datetime(2018,1,2,12,10,0),'destination':Point(-44.4321,-19.8866), 'timeDestination':datetime(2018,1,1,12,15,0),'inflow':15,'outflow':30,},
]).set_index('id')
flowDs["avgFlow"] = flowDs["inflow"] - flowDs["outflow"]
listLines = [LineString([row["origin"],row["destination"]]) for _, row in flowDs.iterrows()]
flowDs["line"] = listLines
geoFlowDf = gpd.GeoDataFrame(flowDs,geometry = flowDs.line)
geoFlowDf.hvplot(geo=True,tiles=True,hover_cols=["id","avgFlow"], alpha=0.5,line_width=holoviews.dim("avgFlow")*0.3)
这是结果:
有什么方法可以引导线条,或者有其他更好的方法来表示流或轨迹吗?