Get the plot width in Python when stretch_width is used

Hi,

I have an time series of 5 millions points. In order to display it quickly when I handle it (zoom, pan), this time series is resampled according to xmin, xmax and plot_width parameters with a code in Python.

If I fix the “plot_width” parameter in the figure, the resampling works fine but the figure is not responsive. And if I use “stretch_width” as value of “sizing_mode” parameter, the figure is responsive but the resampling algorithm is wrong because I am not able to get the real plot_width. If I cannot get the real plot_width, I would like to get the width of the browser’s window but I do not find the way to do it.

So my question is : is it possible to get the plot_width of a figure when sizing_mode=stretch_width or the width of the browser’s window ?

Thanks a lot,
Jean-Christophe

Plots / figures have inner_width and outer_width properties that give the width/height of the interior plot frame (i.e. excluding axes/border) that update whenever a plot is resized. AFAIK there is not any property that property that records an updated full canvas size (usually the frame dimensions are what are needed)

Thanks a lot for you reply.

My problem is fixed when the plot is resized (pan, zoom) :slight_smile: but not the first time when the plot is created. Better than nothing

Jean-Christophe

@Jean-Christophe_Mala It should have been possible to get initial events since

But there has been alot of internal work in the last six months, it’s possible there was a regression. Can you provide a minimal script that demonstrates that these are not available at first render?