☰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

Cannot change tab title in browser

Community Support
big_red_frog
big_red_frog

What are you trying to do?

I am trying to change the title shown in the tab in chrome when spawning a bokeh graph into the browser with show(…) so that it does not have the default “Bokeh Plot”

What have you tried that did NOT work as expected?

Tried

show(p, title=“My new title”)

also tried

curdoc().add_root(p)
curdoc().title = “My new title”

I only see Bokeh Plot in the tab no matter what I try

⌁   Link to post
b-fontana
b-fontana

Could it be that every time you call curdoc() a different instance is created? The following works on my side:

from bokeh.plotting import curdoc
doc = curdoc()
doc.title = 'My Title'
doc.add_root(...)
⌁   Link to post
big_red_frog
big_red_frog

Thankyou for the response, but I am having no luck with that

from bokeh.io import show, curdoc
...

        p = column(vals_fig, jitter_fig)

        doc = curdoc()
        doc.title = 'My Title'
        doc.add_root(p)
        show(p)

Still shows “Bokeh Plot” in the browser tab title.

Everything else works great!

⌁   Link to post
big_red_frog
big_red_frog

Yep, apologies ( did I miss in the template? Though brain should of done it anyway )

Pretty sure I am on 3.1.0

I will check actual later when on host PC

Associated code is at

Everything else is working as hoped.

Can’t understand what I am missing. Ready to kick self.

⌁   Link to post
Bryan
Bryan

Thanks for the version info @big_red_frog unfortunately what you linked is not a Minimal Reproducible Example. An MRE should be self-contained, and bereft of any extraneous code not directly related to the issue at hand. I would expect and MRE for thies to be in the low tens of lines, at most.

So let’s try another approach. When I run this example:

bokeh/sliders.py at branch-3.2 · bokeh/bokeh · GitHub

with bokeh serve --show sliders.py and Bokeh 3.1, I see the tab with the title “Sliders” as expected:

What happens when you run it? If you don’t get a tab with the expected title, then maybe this is some platform-specific issue, and so we would need detailed information about browser, OS, versions, etc. to have any hope of reproducing. If you do see the expected title, then you’ll need to greatly pare down you code to a self-contained, complete, minimal reproducible example so that we can easily look at the problem in isolation.

⌁   Link to post
big_red_frog
big_red_frog

That seems to run fine, I see tab title of “slides” as expected.

Noting in my case I am running a show call from within an active python application, rather than Bokeh server. Let me see if I can hack that simple example for a show(…) implemention.

⌁   Link to post
big_red_frog
big_red_frog

I cannot get the figure itself to show with my basic approach, as I assume it is differences in runtime launch of bokeh and server implementation.

However, I do get the sliders, by adding a simple

show(inputs)

at the end of the script and just running that.

Once more I am back to “Bokeh Plot” in the browser tab.

⌁   Link to post
big_red_frog
big_red_frog

Changing the code within the provided script to

# Set up layouts and add to document
inputs = column(text, offset, amplitude, phase, freq)

curdoc().add_root(row(inputs, plot, width=800))
curdoc().title = "Sliders"

show(curdoc())

I get

Traceback (most recent call last):
  File "C:\Users\atod\PycharmProjects\bokeh1\main.py", line 77, in <module>
    show(curdoc())
  File "C:\Users\atod\PycharmProjects\bokeh1\amber\Lib\site-packages\bokeh\io\showing.py", line 154, in show
    raise ValueError(_BAD_SHOW_MSG)
ValueError: Invalid object to show. The object to passed to show must be one of:

* a UIElement (e.g. a plot, figure, widget or layout)
* a Bokeh Application
* a callable suitable to an application FunctionHandler
⌁   Link to post
Bryan
Bryan

Actually scratch that, I was thinking of the BokehJS API. I think you are just running into some historical rough edges of Bokeh where original intended usage was a little different (because it was created way before the server existed). There seem to be a few ways to specify a title in the non-server case, but setting curdoc().title does not appear to be one so them. I think your options are:

  • call save (not show) since it accepts a title param
  • call output_file with the desired title before every call to show
⌁   Link to post
big_red_frog
big_red_frog

My understanding is that both of those would force the creation of a file as well as the launched browser session. Is it possible to change the tab title without saving the html file, or is it required ( currently )

⌁   Link to post
Bryan
Bryan

I am afraid I guess I don’t understand your situation or what you are trying to do. show also saves a file. There is no way to open a browser to show Bokeh HTML content without saving a corresponding file.

This (more or less) is all show does:

It’s always been that way and I would not expect it to change. If you don’t provide a filename, Bokeh will try to pick one based on the name of the current script. Perhaps that was confusing into thinking there was not a file being saved.

⌁   Link to post
big_red_frog
big_red_frog

I am spawning a browser tab with all graphs required from runtime python code, so once displayed in the browser, I don’t expect to edit it further, but as I spawn a few seperate bokeh tabs, I want the user to be able to identify which tab is of interest via its title.

If bokeh save a file anyway, then I guess I should try manipulating the file title, I had not realised this.

However the following test code does not work either, sitll generating a tab of “Bokeh Plot”

import numpy as np

from bokeh.io import curdoc, output_file
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show

# Set up data
N = 200
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))

# Set up plot
plot = figure(height=400, width=400, title="my sine wave",
              tools="crosshair,pan,reset,save,wheel_zoom",
              x_range=[0, 4*np.pi], y_range=[-2.5, 2.5])

plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)

output_file(filename="slider.html")
show(plot)
⌁   Link to post
big_red_frog
big_red_frog

That is now working with some code to clean the title and reuse it as a filename

        save_as = os.path.join(get_default_config_directory(),
                               f"{re.sub('[^A-Za-z0-9]+', '_', compound)}.html")
        output_file(filename=save_as, title=compound)
        show(p)

I did not see a file being saved anywhere through bare calls to show(…), but this is sustainable.

⌁   Link to post

End of archived discussion · Replies are disabled