从 CustomJS 调整散景图的大小

Resize bokeh plot from CustomJS

调整 CustomJS 散景图的大小。

window.setXYDimension = function (width, height) {
  fig.plot_width  = width;
  fig.plot_height = height;
  console.log({fig});
  fig.reset(); //reset doesn't exist
  fig.resize(); //resize doesn't exist
  fig.layout(); //layout doesn't exist
};

感谢任何帮助。

这有效。

window.setXYDimension = function (width, height) {
  fig.frame_width  = width;
  fig.frame_height = height;
  fig.properties.width.change.emit();
  fig.properties.height.change.emit();
};

感谢 Smiley 的解决方案。

您也可以使用以下 CustomJS 来调整事件中的图形大小

CustomJS(args=dict(plot1=p1), code="""
plot1.width=1500;
plot1.height=1500;
plot1.document.resize();
"""
)