Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] bokeh.plotting.figure.circle does not display circles in bokeh 3.4.1 #13899

Open
yuji38kwmt opened this issue May 17, 2024 · 5 comments
Open

Comments

@yuji38kwmt
Copy link

yuji38kwmt commented May 17, 2024

Software versions

Python version : 3.12.1 (main, Feb 7 2024, 10:25:21) [GCC 11.4.0]
IPython version : 8.21.0
Tornado version : 6.4
Bokeh version : 3.4.1
BokehJS static path : /home/yuji/.pyenv/versions/3.12.1/lib/python3.12/site-packages/bokeh/server/static
node.js version : (not installed)
npm version : (not installed)
jupyter_bokeh version : (not installed)
Operating system : Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

Browser name and version

Google Chrome 124.0.6367.208(Official Build)

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

I created the figure with bokeh.plotting.figure.circle method.

I expected that circles are displayed in the figure.

Observed behavior

But circles are not displayed in the figure.
And no warning was displayed in stdout.

Example code

from bokeh.io import output_file, save
from bokeh.plotting import figure, ColumnDataSource

fig = figure(width=400, height=400)

data = {"a": [1, 2, 3], "b": [3, 1, 2]}
source = ColumnDataSource(data)

fig.circle(
    source=source,
    x="a",
    y="b",
)

output_file("output.html")
save(fig)
$ python sample.py

Stack traceback or browser console output

When specifying radius argument, circles are displayed in the figure.

fig.circle(
    source=source,
    x="a",
    y="b",
    radius=0.1
)

When specifying size argument, circles are displayed in the figure and BokehDeprecationWarning occurred in the console.

fig.circle(
    source=source,
    x="a",
    y="b",
    size=8
)
$ python sample.py
BokehDeprecationWarning: 'circle() method with size value' was deprecated in Bokeh 3.4.0 and will be removed, use 'scatter(size=...) instead' instead.

Screenshots

image

@bryevdv
Copy link
Member

bryevdv commented May 17, 2024

@yuji38kwmt Your original code, with size=8 added, plots just fine for me:

Screenshot 2024-05-17 at 10 02 20

You'll need to look for some additional information, e.g. is there any output or error messages in the browser's JS console log?

@mattpap
Copy link
Contributor

mattpap commented May 17, 2024

data = {"a": [1, 2, 3], "b": [3, 1, 2]}
source = ColumnDataSource(data)

fig.circle(source=source,  x="a",  y="b")

In 3.3 and earlier this would produce Scatter glyph, which has a default value for size property (4), that results in a working plot. Whereas now this will produce Circle glyph which has a field("radius") default value for radius property, which doesn't result in a working plot.

In bokehjs radius positional argument in fig.circle(x, y, radius, ...args) is required, so at least there will be an immediate error. In bokeh's plotting API this argument is optional and omitting it, like in the test case, results in an empty plot and the warning in JS console:

[bokeh 3.5.0-dev.3] attempted to retrieve property array for nonexistent field 'radius'

@yuji38kwmt
Copy link
Author

yuji38kwmt commented May 20, 2024

You'll need to look for some additional information, e.g. is there any output or error messages in the browser's JS console log?

@bryevdv I summarized screenshot images and browser console again.

If radius is None and size is None

$ python sample.py
$ 
fig.circle(
    source=source,
    x="a",
    y="b",
)

image

Browser Console

[bokeh 3.4.1] setting log level to: 'info'
bokeh-3.4.1.min.js:184 [bokeh 3.4.1] attempted to retrieve property array for nonexistent field 'radius'
uniform @ bokeh-3.4.1.min.js:184
bokeh-3.4.1.min.js:166 [bokeh 3.4.1] document idle at 40 ms

If radius is None and size is not None

fig.circle(
    source=source,
    x="a",
    y="b",
    size=8
)
$ python sample.py
BokehDeprecationWarning: 'circle() method with size value' was deprecated in Bokeh 3.4.0 and will be removed, use 'scatter(size=...) instead' instead.

image

Browser Console

[bokeh 3.4.1] setting log level to: 'info'
bokeh-3.4.1.min.js:166 [bokeh 3.4.1] document idle at 68 ms

If radius is not None and size is None

fig.circle(
    source=source,
    x="a",
    y="b",
    radius=0.1
)
$ python sample.py
$

image

Browser Console

[bokeh 3.4.1] setting log level to: 'info'
bokeh-3.4.1.min.js:166 [bokeh 3.4.1] document idle at 77 ms

@yuji38kwmt
Copy link
Author

yuji38kwmt commented May 20, 2024

In bokehjs radius positional argument in fig.circle(x, y, radius, ...args) is required,

In bokeh 3.3.4, the following code worked without any problems.

fig.circle(
    source=source,
    x="a",
    y="b",
)

So, I was not aware that radius argument is required.

@golmschenk
Copy link
Contributor

golmschenk commented May 21, 2024

I'm seeing a similar issue where, if neither size nor radius is set, no circle glyphs appear. I would expect that the default setting (not setting either) would still have glyphs appear. It occurs in both Safari and Chrome.

Example

from bokeh.io import show
from bokeh.plotting import figure as Figure

figure = Figure()
figure.circle(x=[0, 1, 2], y=[3, 5, 4])
show(figure)

screenshot_2024_05_21_12_04_47

Output of bokeh info

Python version        :  3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:49:36) [Clang 16.0.6 ]
IPython version       :  8.12.3
Tornado version       :  6.4
Bokeh version         :  3.4.1
BokehJS static path   :  /opt/homebrew/Caskroom/mambaforge/base/envs/haplo/lib/python3.11/site-packages/bokeh/server/static
node.js version       :  v21.6.2
npm version           :  10.2.4
jupyter_bokeh version :  (not installed)
Operating system      :  macOS-14.4.1-arm64-arm-64bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants