question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] "set_select" and "select" are not working well with layouts

See original GitHub issue

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'
)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
kumaran-14commented, Jan 29, 2020

@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?

0reactions
bryevdvcommented, Feb 2, 2020

@kumaran-14 you need to make sure you have done pip install channels first. There is not a conda package for it yet, and isort gets confused about some third part vs package imports if it is not installed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UICollectionView Select and Deselect issue - Stack Overflow
I find that if you set "selected to true" - if there is an relation between the main object and image in cellForItemAtIndexPath...
Read more >
Understand data-form layout for canvas apps - Power Apps
Learn about how to create great-looking form layouts in canvas apps by using rows and columns.
Read more >
Row Selection - JavaScript Data Grid
Working with AG Grid nodes is preferred over the row data as it provides you with more information and maps ... It is...
Read more >
Automations and Templates — ESPHome
All automations you define in ESPHome are executed on the ESP itself and will continue to work even if the WiFi network is...
Read more >
JDK-6584657 GTK Look and Feel: Bugs in menu item layout
It fixes menu item bugs for several L&Fs, but doesn't for GTK L&F. This CR is targeted to solve menu item problems under...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found