Skip to content

initial range calculation for log plots can cause empty plots #5576

Closed
@clairetang6

Description

@clairetang6

PR 5477 introduced a bug where plots can show up empty if the initial range calculation returns NaN (when data values are <=0 or None).

Before PR 5477 the code below produced:
image

After PR 5477:
image

from bokeh.plotting import figure, output_file, show
from bokeh.layouts import gridplot

output_file('initial_log_range')

x = [1, 2, 3]

# fig1
y = [0.1, 0.2, 0.9]
fig1 = figure(y_axis_type='log', plot_width=300, plot_height=300)
fig1.line(x,y)

# fig2
y = [None, 0.2, 0.9]
fig2 = figure(y_axis_type='log', plot_width=300, plot_height=300)
fig2.line(x,y)

# fig3
y = [-10, 0.2, 0.9]
fig3 = figure(y_axis_type='log', plot_width=300, plot_height=300)
fig3.line(x,y)

# fig4
y = [-10, 0.2, 10]
fig4 = figure(y_axis_type='log', plot_width=300, plot_height=300)
fig4.line(x,y)

grid = gridplot([[fig1, fig2],[fig3, fig4]])

show(grid)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions