bokeh: [BUG] "set_select" and "select" are not working well with layouts
With the rest of the elements: Circles, LinearAxis, Title the method set_select works well as you can check in the following example. But, I am not able to make it work when I try to select plots through the layout:
from bokeh.io import show
from bokeh.models import ColumnDataSource, LinearAxis, Title, Circle, Plot
from bokeh.plotting import figure, Figure
from bokeh.layouts import column, row
source = ColumnDataSource(dict(
x=[1, 2, 3, 4, 5, 6],
y=[1, 2, 3, 4, 5, 6],
))
# ------------------ PLOT 1 ---------------------- #
p = figure(
title='Original',
plot_width=200,
plot_height=200,
x_axis_label='X Axis',
y_axis_label='Y Axis',
tools='lasso_select,tap',
)
p.circle(
x='x', y='y',
size=3, source=source
)
p.xaxis.axis_label_text_font_style = 'normal'
p.yaxis.axis_label_text_font_style = 'normal'
# ------------------ BIGGER PLOT ---------------------- #
p2 = figure(
name='bigger',
title='Bigger',
plot_width=200*3,
plot_height=200*3,
x_axis_label='X Axis',
y_axis_label='Y Axis',
tools='',
toolbar_location=None,
)
c2 = p2.circle(
name='p2_circle',
x='x', y='y',
size=3, source=source
)
p2.xaxis.axis_label_text_font_style = 'normal'
p2.yaxis.axis_label_text_font_style = 'normal'
big_width = 2
p2.set_select(
selector=LinearAxis,
updates=dict(
axis_line_width=big_width,
major_tick_line_width=big_width,
minor_tick_line_width=big_width,
axis_label_text_font_size='15pt',
major_label_text_font_size='10pt'
)
)
p2.set_select(
selector=Title,
updates=dict(text_font_size='20pt')
)
p2.set_select(
selector=Circle,
updates=dict(size=15)
)
r = row([p, p2])
r.set_select(
selector=Figure,
updates=dict(
plot_width=500,
)
)
# r.set_select(
# selector=Plot,
# updates=dict(
# plot_width=500,
# )
# )
show(r)
And I am getting this error
Traceback (most recent call last):
File "set_select_plot.py", line 81, in <module>
plot_width=500,
File "env\lib\site-packages\bokeh-1.3.4-py3.7.egg\bokeh\model.py", line 628, in set_select
for obj in self.select(selector):
File "env\lib\site-packages\bokeh-1.3.4-py3.7.egg\bokeh\core\query.py", line 87, in <genexpr>
return (obj for obj in objs if match(obj, selector, context))
File "env\lib\site-packages\bokeh-1.3.4-py3.7.egg\bokeh\core\query.py", line 159, in match
for key, val in selector.items():
AttributeError: type object 'Figure' has no attribute 'items'
Also, If I use select in a plot like this works well
p2.select(
name='p2_circle'
)
And if I use the method with a layout an error is thrown TypeError: select() got an unexpected keyword argument 'name':
r.select(
name='p2_circle'
)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (15 by maintainers)
@bryevdv I’d like to take an attempt at this. I have built bokeh from source and can start right away.
What should I look into?