I work for a saas company that uses bokeh to render almost all of their reporting. Recently we decided to upgrade from 2.4.3 to 3.4. I’m running into some issues now that figure’s plot_height and plot_width are deprecated.
Is this multi object figure on the following webpage not displaying correctly (scroll down to sizing modes - multiple objects near bottom of page)? Seems like the plot is taking up no width.
We have a similar issue of the plot not taking up any width.
This is some of the code we use to build it out. It’s not a minimal reproducible example but hopefully this is helpful. Previously we were passing plot_height and plot_width into figure and everything worked fine.
self.upper_plot.build_plot(plot_height=300,plot_width=900)
self.lower_plot.build_plot(title='AUR',
x_range=self.upper_plot.plot.x_range,
plot_height=200,
plot_width=900)
controls = self.widgets.return_widget_list()
inputs = column(*controls)
main_col = column(self.upper_plot.plot,
self.lower_plot.plot,
sizing_mode='stretch_width')
display_row = row(inputs, main_col)
Here is an example build_plot function
def build_plot(self,
plot_height=400,
plot_width=1200,
title='Unit Sales',
title_font_size='18pt',
label_font_size='12pt',
title_align='center',
tools="pan, box_zoom, wheel_zoom, reset, hover, save",
text_font='calibri',
x_range=None):
"""This method build the plot with the current options"""
try:
logger.debug('Building Plot')
if x_range is not None:
plot = figure(height=plot_height,
width=plot_width,
sizing_mode='stretch_width',
x_axis_type='datetime',
title=title,
tools=tools,
x_range=x_range)
else:
plot = figure(height=plot_height,
width=plot_width,
sizing_mode='stretch_width',
x_axis_type='datetime',
title=title,
tools=tools)
plot.title.text_font_size = title_font_size
plot.title.align = title_align
plot.axis.major_label_text_font_size = label_font_size
plot.xaxis[0].formatter.years = ['%Y-%m']
plot.xaxis[0].formatter.months = ['%Y-%m']
plot.xaxis[0].formatter.days = ['%Y-%m-%d']
plot.toolbar.logo = None
plot.title.text_font = text_font
plot.axis.major_label_text_font_size = label_font_size
plot.axis.major_label_text_font = text_font
plot.yaxis[0].formatter.use_scientific = False
self.plot = plot
self.hovertool()
except Exception as e:
error_client.report_exception()
logger.error('Encountered error: %s', e)