[bokeh] error using 'bokeh serve' and list of circle sizes

Hi

This is a bug, there is already an issue you can track:

  screen distance spec fields fail with bokeh.client · Issue #6409 · bokeh/bokeh · GitHub

Thanks,

Bryan

···

On Jul 14, 2017, at 12:19, [email protected] wrote:

import numpy as np

import bokeh.models
from bokeh.plotting import figure, curdoc
from bokeh.client import push_session

# create a plot and style its properties
fig = figure(x_range=(0, 100), y_range=(0, 100), toolbar_location=None)

x_data = np.array([0,2,4])
y_data = np.array([0, 2, 4])
size_data = np.array([1, 1, 2])

source = bokeh.models.ColumnDataSource(data={'x':x_data, 'y':y_data, 'size':size_data})

#OK always:
#fig.circle(x='x', y='y', radius='size', source=source)

#OK if server=False; FAIL, if server=True:
fig.circle(x='x', y='y', size='size', source=source)
# error handling message Message 'PATCH-DOC' (revision 1):
# ValueError("expected an element of either String, Dict(Enum('field', 'value', 'transform'),
# Either(String, Instance(Transform), Float)) or Float, got {u'units': u'screen', u'field': u'size'}",)

server = True

if server is False:
    # run with 'bokeh serve --show test_bokeh.py'
    curdoc().add_root(fig)
else:
    # run 'bokeh serve' first, then 'python test_bokeh.py
    # using: 'Starting Bokeh server version 0.12.6 (running on Tornado 4.5.1)'
    
    # set up session
    session = push_session(curdoc())
    curdoc().add_root(fig)
    session.show() # open the document in a browser
    session.loop_until_closed() # run forever