Fix color mapping over time when using slider

I am plotting weather forecasts over time using geoviews holomap with a slider (which works beautifully). However, the color map for the forecasted values get rescaled at each time steps, so it’s hard to make sense of the forecasts over time. How do I freeze the color map so it is the same at ever time?

Hi @tdhopper

Could you provide a minimum reproducible example and an image or video? That would make it much easier to help.


.opts(clim=(1, 100))

This topic is a constant struggle. I think we should document this better.

You can understand a little bit about what is going on and how to control the behavior here: (look at the questions about auto-ranging and the one that comes after that)

The likely working solution is to use options framewise=False, dynamic=False. I would also try the solution that @ahuang11 proposed, I have not tried it.

However, the downside with dynamic=False is that it switches your elements from Dynamicmap to Holomap, which might make things quite a bit slower for some cases.

Older related questions:


This is the code I’m using. I’m not able to share the grib file I have, unfortunately.

        dataset = gv.Dataset(wrf_file, kdims=["gridlon_0", "gridlat_0", "time"])
        weather_opts = dict(
            cmap="jet",  # "blues",
            title=f"WRF show DZDT_P8_2L104_GLC0_avg1h",
            tools=["hover", "box_select"],
        ensemble = rasterize(
        return gf.states().opts(color="white") * (ensemble).opts(**weather_opts)

Here’s a video showing what happens