How to reduce or eliminate the margin space in plotly express chart python?

image = px.imshow(palette)
image.update_layout(xaxis=dict(tickvals=new_ticks, ticktext=new_ticks_labels), yaxis=dict(tickvals=[], ticktext=[]),
                   margin=dict(l=0, b=0, r=0, t=0, pad=0))

fig = go.FigureWidget(image)
fig.add_image(colormodel="rgb")
img = fig.data[0]

out = Output()
@out.capture(clear_output=True)
def handle_click(trace, points, state):
    print(points.point_inds)

img.on_click(handle_click)
VBox([fig, out])

The following figure has excessive margin space and I have set the margin for all the sides to 0 but still the margin space stays the same. I only want the figure as the output without any whitespace.

Also, I tried messing up with the top and bottom values but it either ended up leaving huge space in bottom or top so is there some way to inly get the figure? Thank you for your help!