question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Colorbar legend disappearing and moving out of view when using cnorm='eq_hist' in holoviews.operation.datashader.rasterize

See original GitHub issue

holoviews: 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: start About half a second later the legend disappears: after_one_second And after dragging around: after_dragging_around_a_few_times 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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Noskariocommented, Sep 23, 2021

Indeed, now everthing works fine, after I have restarted the computer. Thanks a lot for helping out!

0reactions
jbednarcommented, Sep 22, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with large data using datashader — HoloViews v1.15.3
HoloViews provides several operations for calling Datashader on HoloViews elements, including rasterize() , shade() , and datashade() .
Read more >
FAQ — Datashader v0.14.3
For instance, to get a colorbar in HoloViews, use rasterize() to invoke datashader on the data and generate an array of values; do...
Read more >
Control resolution of rasterized plots · Issue #626 · holoviz/hvplot
I'm using ds.hvplot.quadmesh to project and visualise a heatmap of geospatial ... from holoviews.operation.datashader import rasterize p ...
Read more >
Legend entry for rasterized curve - HoloViews
When plotting several hv.Curves using the bokeh backend, when clicking on a legend entry, the corresponding curve gets muted, i.e., ...
Read more >
Prevent the colormap to be rescaled when using datashader ...
I found my answer in this comment from 2017 on the Holoviews issue tracker. The following works regrid(hv_im).opts(clim=(im.min(), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found