bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
253 stars 48 forks source link

Not rendering image np.uint16 in Jupyter Notebooks #69

Closed caviri closed 4 years ago

caviri commented 4 years ago

Hello,

I'm having issues plotting a 2D array of np.uint16 datatype. If I convert it to np.uint32 or to np.float16. Is this datatype supported?

array = 2Darray

source = ColumnDataSource(data=dict(image=[array]))
p = figure(plot_width=width, x_range=(0, size_x), y_range=(0, size_y * y_factor), match_aspect=True,tooltips=[("x", "$x{0}"), ("y", "$y{0}"), ("value", "@image{0.00}")])

p.image(image='image', x=0, y=0, dw=size_x, dh=size_y, color_mapper=color_mapper)
jupyter                   1.0.0                    py37_7  
jupyter-server-proxy      1.1.0                    pypi_0    pypi
jupyter_client            5.3.3                    py37_1  
jupyter_console           6.0.0                    py37_0  
jupyter_core              4.5.0                      py_0  
jupyterhub                1.0.0                    py37_0    conda-forge
jupyterhub-dummyauthenticator 0.3.1                    pypi_0    pypi
jupyterlab                1.1.4              pyhf63ae98_0  
jupyterlab-nvdashboard    0.1.9                    pypi_0    pypi
jupyterlab_code_formatter 0.5.0                      py_0    conda-forge
jupyterlab_server         1.0.6                      py_0  
bokeh                     1.0.4                    py37_0

Thanks! and congrats for the great work!

mattpap commented 4 years ago

uint16 should be work fine, though this dtype isn't particularly well tested. Given that this issue doesn't seem to be related to the jupyter extension, but may be a bug in bokeh, please resubmit this to https://github.com/bokeh/bokeh/issues with a complete, runnable test case.