Skip to content

[BUG] Log axis figures don't render if they're not visible at start #11801

@EfremBraun

Description

@EfremBraun

ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

Bokeh 3.0.0dev1+24.g0f5f99466
Python 3.9.6
MacOS Catalina 10.15.7
Chrome 95.0.4638.69

Description of expected behavior and the observed behavior

I put stacks plots such that the user can change between log-plot and lin-plot upon clicking a checkbox. However, upon first rendering the plot, the log-plot that is below isn't rendered. After clicking the "Reset" button, the log-plot renders.

I assume this is somewhat related to #11770, but perhaps not.

Complete, minimal, self-contained example code that reproduces the issue

from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Button
from bokeh.io import curdoc
from bokeh.layouts import column

LineRef = ColumnDataSource(data=dict(x=[1, 2], y=[1, 2]))

def updateData():
    figure2.visible=False
    figure1.visible=True

button = Button(label='Change')
button.on_click(updateData)

figure1 = figure(visible=False)
figure2 = figure(x_axis_type='log', y_axis_type='log')
figure1.line(x='x', y='y', source=LineRef)
figure2.line(x='x', y='y', source=LineRef)

curdoc().add_root(column(button, figure1, figure2))

Stack traceback and/or browser JavaScript console output

Upon clicking the change button, I get this console output:

bokeh.min.js?v=106a2270510621557ac35604d45cfa81816e9a588ddf9b3775bf902b93e02795b53d464b32e7b1892ae7c74db2c378e78c99265a4eec4e681af1f486278411f5:526 [bokeh] could not set initial ranges

Screenshots or screencasts of the bug in action

Before clicking change:
Screen Shot 2021-11-14 at 6 43 28 PM

After clicking change:
Screen Shot 2021-11-14 at 6 43 30 PM

After clicking the reset button:
Screen Shot 2021-11-14 at 6 51 30 PM

Note

If the linear-scale plot is put on top, and clicking the button switches to log-scale, as per the following code, everything works fine:

from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Button
from bokeh.io import curdoc
from bokeh.layouts import column

LineRef = ColumnDataSource(data=dict(x=[1, 2], y=[1, 2]))

def updateData():
    figure1.visible=False
    figure2.visible=True

button = Button(label='Change')
button.on_click(updateData)

figure1 = figure()
figure2 = figure(x_axis_type='log', y_axis_type='log', visible=False)
figure1.line(x='x', y='y', source=LineRef)
figure2.line(x='x', y='y', source=LineRef)

curdoc().add_root(column(button, figure1, figure2))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions