MSA msa
MSA msa

Reputation: 83

Nesting a DynamicMap inside a DynamicMap is not supported

I have different timeseries plot for different time series i made holomap , now i am plotting different lat lon range holomap then i am getting exception :- Exception: Nesting a DynamicMap inside a DynamicMap is not supported. Ensure that the DynamicMap callback returns an Element or (Nd)Overlay. If you have applied an operation ensure it is not dynamic by setting dynamic=False.

:DynamicMap [Lat and Lon :] :DynamicMap [Date and Time :] I am not getting plot as nesting of dynamicmap ,

I have tried to make rasterize at last final plot . it didn't work

    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

I want my lat_lon_selPlot holomap also work .

Upvotes: 1

Views: 702

Answers (2)

MSA msa
MSA msa

Reputation: 83

For selecting only the selected lat lon range i am doing another process of panel.select. but first select.value is getting selected and when i change the select.value of another then the plot is not getting changed. where i am doing wrong ? how i can link with jlink , is my jlink correct ?

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

How i can link up another select.value options , so that different plot come when select.value change ?

Upvotes: 1

philippjfr
philippjfr

Reputation: 4080

rasterize is a so called dynamic operation, which means that it returns a DynamicMap which updates whenever one of its streams changes. In the case of rasterize this allows it to update whenever the range of your plot changes. If you do not want the dynamic behavior you have to specify dynamic=False in the rasterize call, in your case that means you will have:

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

That said it looks like you would still have nested HoloMaps in that case. To resolve that you will then have to call `.collate``

hmap11 = hv.HoloMap(latlon_selPLot, kdims='Lat and Lon :' ).collate()

Upvotes: 0

Related Questions