Colorbar legend disappearing and moving out of view when using cnorm='eq_hist' in holoviews.operation.datashader.rasterize
See original GitHub issueholoviews: 1.14.5 bokeh: 2.3.3 pandas: 1.2.4
When plotting data using rasterize I want to include a colorbar. But with the nicest cnorm-option ‘eq_hist’ the legend of the colorbar disappears about .5 seconds after creation. Why is that? Moreover, if I drag around the map a few times, each time it gets redrawn a bit more down right until it shifts out of the printable area of my notebook!
I use the New York taxi dataset also used in https://datashader.org/getting_started/Introduction.html
import pandas as pd
import holoviews as hv
from holoviews.element.tiles import EsriImagery
from holoviews.operation.datashader import rasterize
hv.extension('bokeh')
# You have to adapt the path
df = pd.read_csv(r'C:\Users\oskar\datashader-examples\data\nyc_taxi.csv', usecols=['dropoff_x', 'dropoff_y'])
map_tiles = EsriImagery().opts(alpha=0.5, width=900, height=480, bgcolor='black')
points = hv.Points(df, ['dropoff_x', 'dropoff_y'])
taxi_trips = rasterize(points, x_sampling=1, y_sampling=1, width=900, height=480).opts(colorbar=True,cnorm='eq_hist')
taxi_trips * map_tiles
At first everything is nice: About half a second later the legend disappears: And after dragging around: Note that the legend does not disappear if the numbers are all small, only if the highest number is above 5000 it seems. Also note, that everything works fine if using cnorm=‘log’.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Indeed, now everthing works fine, after I have restarted the computer. Thanks a lot for helping out!
Ok, that behavior would be expected for 2.3.2. I used your same source code under 2.3.3 with no issues, so I imagine it’s just an issue of restarting and rerunning everything after the upgrade. You’d see the above if Python isn’t running but the JS is.