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.
Thanks.
.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:
https://holoviews.org/FAQ.html (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:
- Inconsistent behavior of colormap for Adjoint layout with hist (some of the issue raised here is answered in the FAQ link I post above).
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",
alpha=0.9,
title=f"WRF show DZDT_P8_2L104_GLC0_avg1h",
width=600,
height=600,
colorbar=True,
framewise=False,
tools=["hover", "box_select"],
)
ensemble = rasterize(
gv.project(
dataset.to(
gv.QuadMesh,
vdims="DZDT_P8_2L104_GLC0_avg1h",
)
)
)
return gf.states().opts(color="white") * (ensemble).opts(**weather_opts)
Here’s a video showing what happens https://youtu.be/f0hI5z2zzx0