bqplot / bqplot

Plotting library for IPython/Jupyter notebooks

Home Page:https://bqplot.github.io/bqplot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error is thrown when a cell is selected in GridHeatmap

ChakriCherukuri opened this issue · comments

Describe the bug
When selection is enabled (interactions={"click": "select"}) in the GridHeatmap and a cell is clicked below exception is thrown:

File ~/miniconda3/envs/mlviz/lib/python3.9/site-packages/bqplot/traits.py:177, in array_to_json(ar, obj, force_contiguous)
    175         return [array_to_json(np.array(row), obj, force_contiguous) for row in ar]
    176     else:
--> 177         raise ValueError("Unsupported dtype object")
    179 if ar.dtype.kind in ['S', 'U']:  # strings to as plain json
    180     return ar.tolist()

ValueError: Unsupported dtype object

To Reproduce
Code to reproduce the error:

fig = plt.figure(padding_y=0)

grid_map = plt.gridheatmap(
    np.random.rand(4, 4), 
    interactions={"click": "select"}
)
fig

When you click on any cell to select it, the above exception is thrown

Expected behavior
grid_map.selected should be updated with the [row_id, col_id]

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
bqplot >= 0.12.36
ipywidgets >= 7.7.0