1

我为制作全息图的不同时间序列绘制了不同的时间序列图,现在我正在绘制不同的纬度范围全息图,然后出现异常:- 异常:不支持在 DynamicMap 中嵌套 DynamicMap。确保 DynamicMap 回调返回一个元素或 (Nd)Overlay。如果您已应用操作,请通过设置 dynamic=False 确保它不是动态的。

:DynamicMap [Lat and Lon :] :DynamicMap [Date and Time :] 我没有得到作为 dynamicmap 嵌套的情节,

我试图在最后的最终情节中进行光栅化。它没有用

    latlon_selPLot={f'lat:{k[0]} lon:{k[1]}':finalplot(k) for k in 
    [[(12,15),(80,85)],[(13,18),(81,95)]]}
    dd=df_div.opts(width=200, height=100)
    hmap11 = hv.HoloMap(latlon_selPLot, kdims='Lat and Lon :' )
    tiles*rasterize(hmap11)



 # Below is the code i am using , where i have to make change , 
 # so that i get holomap of lat_lon_selPlot when i select one 
 #lat_lon range then that particular area plot is shown .


 allplot={k.strftime("%Y-%m-%d %H:%M:%S"):plotthis(k)for k in 
 perdelta(strt, strt + timedelta(days=1), timedelta(hours=18))}
 allplot2={k.strftime("%Y-%m-%d %H:%M:%S"):plotsecond(k)for k in 
 perdelta(strt, strt + timedelta(days=1), timedelta(hours=18))}
 ....

 tiles = gv.tile_sources.Wikipedia
 hmap1 = hv.HoloMap(allplot, kdims='Date and Time :' )
 hmap2 = hv.HoloMap(allplot2, kdims='Date and Time :')

def finalplot(rng):

        finalplot=rasterize(hmap1.redim.range(Latitude=rng[0], 
        Longitude=rng[1])).options(**opts)*hmap2
        return finalplot

latlon_selPLot={f'lat:{k[0]} lon:{k[1]}':finalplot(k) for k in 
[[(12,15),(80,85)],[(13,18),(81,95)]]}
dd=df_div.opts(width=200, height=100)
hmap11 = hv.HoloMap(latlon_selPLot, kdims='Lat and Lon :' )
tiles*hmap11

我希望我的 lat_lon_selPlot 全息图也可以工作。

4

2 回答 2

1

为了仅选择选定的经纬度范围,我正在执行 panel.select 的另一个过程。但首先 select.value 被选中,当我更改另一个的 select.value 时,情节并没有改变。我在哪里做错了?我如何与 jlink 链接,我的 jlink 是否正确?

tiles = gv.tile_sources.Wikipedia
hmap1 = hv.HoloMap(allplot, kdims='Date and Time :' )
hmap2 = hv.HoloMap(allplot2, kdims='Date and Time :')
finalplot=tiles*rasterize(hmap1).options(**opts)*hmap2
dd=df_div.opts(width=200, height=100)

select = pn.widgets.Select(name='States', options=['TN','AP', 'Odisha'])
 latmin = [7, 13, 19]
 latmax = [14, 19, 22]
 longmin = [77, 79, 85]
 longmax = [83, 85, 88]
if (select.value=='TN'):
    hhmap = rasterize(hmap1.redim.range(Latitude=(latmin[0],latmax[0]), Longitude= 
 (longmin[0], longmax[0])))
   select.jslink(finalplot, value='object')
    finalplot=tiles*hhmap*hmap2

 elif (select.value=='AP'):
      hhmap =rasterize(hmap1.redim.range(Latitude=(latmin[1],latmax[1]), Longitude= 
 (longmin[1], longmax[1]))).options(**opts)
   select.jslink(finalplot, value='object')
    finalplot=tiles*rasterize(hhmap)*hmap2

else:
    hhmap = rasterize(hmap1.redim.range(Latitude=(latmin[2],latmax[2]), Longitude= 
   (longmin[2], longmax[2]))).options(**opts)
    select.jslink(finalplot, value='Odisha')
    finalplot=tiles*rasterize(hhmap)*hmap2
 # else:
 #     tiles*rasterize(hmap1).options(**opts)*hmap2

 finalplot=tiles*rasterize(hhmap).options(**opts)*hmap2
  finalplot=pn.Column(dd, finalplot, select).servable()    
  # finalplot=pn.Column(dd, finalplot).servable()
 finalplot

我如何链接另一个 select.value 选项,以便在 select.value 更改时出现不同的情节?

于 2019-09-20T12:59:26.453 回答
0

rasterize是一种所谓的动态操作,这意味着它返回一个 DynamicMap,只要其中一个流发生变化,它就会更新。在这种情况下,rasterize它可以在您的绘图范围发生变化时进行更新。如果您不想要必须dynamic=False在 rasterize 调用中指定的动态行为,在您的情况下,这意味着您将拥有:

def finalplot(rng):
    return rasterize(hmap1, x_range=rng[1], y_range=[0], dynamic=False).options(**opts)*hmap2

也就是说,在这种情况下,您似乎仍然会有嵌套的 HoloMaps。为了解决这个问题,你必须调用`.collat​​e`

hmap11 = hv.HoloMap(latlon_selPLot, kdims='Lat and Lon :' ).collate()
于 2019-09-20T08:44:08.990 回答