Black Lives Matter. Please consider donating to Black Girls Code today.

Numpy array to hover widget

Inspired by the excellent Cars exploration notebook, I am building a simple dashboard widget for the iris dataset. Showing hover widgets for point info or selection statistics works fine. However, I would like to present more information in the dashboard, for example an histogram for the selected points in the plot. My naive attempt is this

def hover_histogram(trace, points, state):
    indices = points.point_inds[0]
    histogram.value = (iris_df.iloc[[indices]]).hist().to_image()

scatter_1.on_selection(hover_histogram)

which returns the error message AttributeError: 'numpy.ndarray' object has no attribute 'to_image'. Fair enough.

Is there any existing method to show Numpy arrays as “images” in FigureWidgets without using for instance b64 encoding?