Changing the height of a figure

Hi,

I have a project using bokeh server that I am working on. I need to be able to change the height of one of the plots (bar based) depending on the number of categories that it is displaying so that I get a consistent bar thickness and spacing and minimize empty space.

I have tried replacing the plot in the container with a new one each time the data is regenerated, and this almost works. The whole page appears to get re-drawn, and the new plot usually appears in the correct place, but sometimes not. Also after extended use things start to lag a lot, so I guess that this might be causing a memory leak somewhere.

I have also tried setting the sizing mode of the figure to be responsive, and vary the height of its container, but that doesn’t cause the figure to be resized at all.

I would like to be able to do this on the client using JS in a callback, re-sizing the plot when its data changes. Unfortunately, I have no idea how to access the plot object on the client in order to achieve this (my JS is pretty poor, but I’m a quick learner!). Is it possible to access the necessary objects from a JS callback? If so, can you point me in the right direction?

Thanks!