bokeh / bokeh

Interactive Data Visualization in the browser, from Python

Home Page:https://bokeh.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bokeh.Plotting.figure.circle in bokehjs can't find `x` and `y` in a ColumnDataSource

mosc9575 opened this issue · comments

The circle renderer of bokehjs doesn't fiend the fields x and y.

The example below

// create a data source to hold data
const source = new Bokeh.ColumnDataSource({
    data: { x: [1,2,3], y: [1,2,3] }
});

// make a plot with some tools
const plot = Bokeh.Plotting.figure({
    title: 'Example of random data',
    tools: "pan,wheel_zoom,box_zoom,reset,save",
    height: 300,
    width: 300
});

// add a line with data from the source
plot.circle({ field: "x" }, { field: "y" }, {
    source: source,
});

// show the plot, appending it to the end of the current section
Bokeh.Plotting.show(plot);

produces warnings in the browser console.

"[bokeh 3.4.1]" "attempted to retrieve property array for nonexistent field 'x'"
"[bokeh 3.4.1]" "attempted to retrieve property array for nonexistent field 'y'"

Replacing plot.circle with plot.scatter generates a valid figure.

This happens as a side effect of PR #13283. The API changed and now we have either Figure.circle(x, y, radius, options) or Figure.circle({x, y, radius, ...options}). The third argument was interpreted as radius and effectively no source was provided, which resulted in a cascade of errors.