width/height not taken into account in a `regrid` operation with the Bokeh backend
See original GitHub issueThe regrid
operation does not seem to take into account width
and height
when using the Bokeh backend. The example shows that it does work with the Matplotlib backend. Notice in the GIF how for a very short moment the Bokeh plot seems to have the right grid, and then updates to the original image resolution apparently.
Here’s the full code:
import numpy as np, holoviews as hv
from holoviews.operation.datashader import regrid
hv.extension('bokeh', 'matplotlib')
arr = np.random.rand(200, 200)
img = hv.Image(arr)
regrid(img, width=10, height=10)
hv.output(backend='matplotlib')
regrid(img, width=10, height=10)
Issue Analytics
- State:
- Created a year ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Releases — HoloViews v1.15.3
Take account of labeled dimension in Bokeh plotting classes (#5404) ... In future, HoloViews will not allow non-string values for pandas DataFrame column ......
Read more >Bar plots in holoviews with bokeh backend do not overlay
in plotly the legend should be replaced by name of the overlayed objects - how to do that in plotly aspect, width, height...
Read more >holoviews Changelog - pyup.io
Take account of labeled dimension in Bokeh plotting classes ... In future, HoloViews will not allow non-string values for pandas DataFrame column names....
Read more >Fast Remote Image Viewer - HoloViews - HoloViz Discourse
On start, I'm loading the image plots into a dictionary (and cache) and feeding ... from holoviews.operation.datashader import regrid hv.extension('bokeh') ...
Read more >REST API: db/completion no output when one folder is paused ...
width/height not taken into account in a `regrid ` operation with the Bokeh backend, 1, 2022-05-16, 2022-08-19. Paladin Class has wrong cost increase ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have spent some time looking into that. The base
ResamplingOperation
- from whichregrid
,rasterize
and others inherit - has parameterswidth
andheight
and also sets up by default theRangeXY
andPlotSize
streams.https://github.com/holoviz/holoviews/blob/e5224c6a278829ca6165ac04b36da6d5f55825cf/holoviews/operation/datashader.py#L73-L77
https://github.com/holoviz/holoviews/blob/e5224c6a278829ca6165ac04b36da6d5f55825cf/holoviews/operation/datashader.py#L105-L107
The parameters of the
PlotSize
streams are also calledwidth
andheight
.https://github.com/holoviz/holoviews/blob/e5224c6a278829ca6165ac04b36da6d5f55825cf/holoviews/streams.py#L1424-L1431
Which means that when the
PlotSize
stream is triggered - after rendering - theregrid
operation is called again this time withwidth
andheight
obtained from the stream and as such different from the values provided toregrid
by the user.I’ll offer now solutions for different use cases and ask some questions for how to improve the current state:
regrid(img)
dynamic=False
:regrid(img, width=10, height=10, dynamic=False)
streams
so that the operation doesn’t set thePlotSize
stream:regrid(img, width=10, height=10, streams=[hv.streams.RangeXY])
3 in the list above feels more like a workaround for a bug rather than a clean solution. We played around with a potential bug fix that consists in removing the PlotSize stream if
width
orheight
is provided:We’d really appreciate to hear your thoughts on that @philippjfr:
cc @jlstevens @Hoxbro @droumis
Seems reasonable.