Displaying a grid of rectangular glyphs just like in Bokeh

I am a maintainer of Mesa, an agent-based model library in Python, and we are experimenting with doing interactive display of agents on the Jupyter notebook.

Someone (dmnfarrell) managed to do this via Bokeh (see Bioinformatics and other bits - A simple agent based infection model with Mesa and Bokeh).

See this GIF for the interactive simulation that I need to recreate.

With Bokeh, I can easily render the grid of rectangles via this code

p.rect(x="level_0", y="level_1", width=1, height=1,
       source=df,
       fill_color={'field':'value', 'transform': mapper},
       line_color='black')

I have been looking for an equivalent way to do this via Plotly. But the closes I can get is px.imshow. Unfortunately, with px.imshow, I can’t add the border demarcating the rectangles, nor can I use different shapes. Additionally, with Bokeh, I can use Circle or even Image for custom glyphs.

How should I do this in Plotly? Thank you in advance!

Related: Using image as marker in scatter plot. It looks like there is no short-term nor long-term plan to support custom image as scatter plot markers, which we eventually need.