So after figuring out the spacing issue for px.imshow, I implemented a heatmap plot using this figure into my Dash app. It seems to display in the app just fine, until I try to implement a resizing function.
I set the default size for each imshow graph at 1000x1000, but of course, this would need to be resized in most cases. So I added some inputs for users to resize the imshow graphs to whatever they want. However, if the size is too small, it seems that the pixels in the heatmap just disappear. And even if the image is resized to a larger set of dimensions, the pixels still don’t show and occupy only a fraction of the total image size:
This is the code I used to resize the image:
@app.callback( Output('heat-graph', 'figure'), [Input('heat-sizeh', 'value'), Input('heat-sizew', 'value')], State('heat-graph', 'figure'), background=True, manager=background_callback_manager, prevent_initial_call=True ) def heat_resize(heat_height, heat_width, heat): heat['layout']['height'] = int(heat_height) heat['layout']['width'] = int(heat_width) heat['layout']['autosize'] = False return heat
Is there some minimum height/width for imshow that would cause the graph to break like this? Or should I be resizing the imshow graph some other way other than through update_layout?