☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

adding new lines with legend= breaks figure

Community Support
Sebastien_Roche
Sebastien_Roche

I recently updated from bokeh 0.12.10 to bokeh 1.1.0, adding lines to a plot like below now produces shrinked plots in the canvas

from bokeh.plotting import figure
from bokeh.io import curdoc
from bokeh.layouts import gridplot
from bokeh.models import Button
import numpy as np

main fiure where lines will be plotted

fig = figure()

x = range(10)

def add_line():
new_line = fig.line(x,np.random.random(10)*100,legend=‘line{}’.format(len(fig.renderers)))

button = Button(label=‘test’)
button.on_click(add_line)

grid = gridplot([[button],[fig]],toolbar_location=None)

curdoc().add_root(grid)

``

Here is a screenshot of the output:

Is this a bug? Is there a new way to add new lines with legend in latest versions?

⌁   Link to post
Bryan
Bryan

Definitely a bug.

Thanks,

Bryan

···

On May 20, 2019, at 6:07 PM, Sébastien Roche <sebastienroche11@gmail.com> wrote:

I recently updated from bokeh 0.12.10 to bokeh 1.1.0, adding lines to a plot like below now produces shrinked plots in the canvas

from bokeh.plotting import figure
from bokeh.io import curdoc
from bokeh.layouts import gridplot
from bokeh.models import Button
import numpy as np

# main fiure where lines will be plotted
fig = figure()

x = range(10)

def add_line():
new_line = fig.line(x,np.random.random(10)*100,legend='line{}'.format(len(fig.renderers)))

button = Button(label='test')
button.on_click(add_line)

grid = gridplot([[button],[fig]],toolbar_location=None)

curdoc().add_root(grid)

Here is a screenshot of the output:
<boktest.PNG>

Is this a bug? Is there a new way to add new lines with legend in latest versions?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04ecdc27-e9f8-4acc-a20e-7a60468a45aa%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<boktest.PNG>

⌁   Link to post

End of archived discussion · Replies are disabled