Я пробовал figure.min_border = 0 и figure.min_border_left = 0, но это ничего не дает. Я добавил красный фоновый контур, чтобы продемонстрировать левый отступ. Он находится внутри макета, поэтому не уверен, что это имеет значение.
from bokeh.plotting import ColumnDataSource, figure, output_file, show
from bokeh.models import Range1d, HoverTool, Div, LabelSet, ColumnDataSource
from bokeh.layouts import gridplot, layout
sectorsDF = pandas.DataFrame(list(zip(sectors, sectorsCount, sectorColors)),
columns=['sectorName', 'sectorCount', 'sectorColors'])
sectorsDF['sectorPct'] = round(sectorsDF['sectorCount'] / numberOfApps * 100, 1)
sectorsDF['textLabel'] = ' ' + sectorsDF['sectorCount'].astype(str) + ' (' + sectorsDF['sectorPct'].astype(str) + '%)'
sectorsDF.sort_values(by=['sectorCount'], inplace=True)
sectorsDF['yRange'] = yRange
sectorToolTip = [
('Employment Sector:', '@sectorName'),
('Number of Families Employed:', '@sectorCount'),
('Percent of Families Employed:', '@sectorPct')
]
employmentSectorsGraph = figure(y_range=sectorsDF['sectorName'], tooltips=sectorToolTip)
employmentSectorsGraph.hbar(y='sectorName',
right='sectorCount',
color='sectorColors',
height=0.5,
left=0,
source=sectorsDF)
sectorSource = ColumnDataSource(sectorsDF)
sectorLabels = LabelSet(x='sectorCount', y='yRange',
text='textLabel', source=sectorSource, render_mode='canvas', text_color='#808080', text_font_size='12px')
employmentSectorsGraph.add_layout(sectorLabels)
employmentSectorsGraph.outline_line_color = None
employmentSectorsGraph.x_range.range_padding = 0
employmentSectorsGraph.x_range = Range1d(0, (max(employmentSectorsCount) + 100))
employmentSectorsGraph.toolbar_location = None
employmentSectorsGraph.min_border = 0
employmentSectorsGraph.background = 'red'
employmentSectorsGraph.xaxis.visible = False
employmentSectorsGraph.xaxis.minor_tick_line_color = None
employmentSectorsGraph.xaxis.major_tick_line_color = None
employmentSectorsGraph.ygrid.grid_line_color = None
employmentSectorsGraph.yaxis.minor_tick_line_color = None
employmentSectorsGraph.yaxis.major_tick_line_color = None
employmentSectorsGraph.yaxis.major_label_text_font_size = '0.75rem'
myLayout = layout([
[mainTitle],
[totalApps, numberChildren, medianIncome, medianSize],
[appsByCountyWidget, appStatusChart],
[employmentSectorsGraph]],
sizing_mode = 'stretch_width')
show(myLayout)