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

curdoc().theme = Theme(json=yaml.load()) is not applied to charts when used in Jupyter notebook #4722

user32000 opened this issue Jul 1, 2016 · 4 comments · Fixed by #5932


Copy link

Running the color slider example in a Jupyter notebook it seems that the defaults defined in the theme are not applied

@bryevdv bryevdv added this to the short-term milestone Jul 2, 2016
Copy link

same problem

Copy link

rubik commented Sep 28, 2016

Same. I've tried everything, from curdoc().theme = Theme(...) to bokeh.themes.default = Theme(...), but nothing seems to be working.

Any ideas?

Copy link

djpugh commented Nov 21, 2016

As with #4952 - It looks like it may be the use of with _ModelInEmptyDocument(model): in notebook_div - I assume this is where the embedding occurs

Copy link

ghost commented Oct 14, 2017

First of all, awesome work. Bokeh sets the current standard thanks to all your efforts.

Second, I am still running into the issue of not having a theme affect the style of the notebook display with version 0.12.9. I would expect the following code to produce a plot with a pink background:

from bokeh.plotting import figure 
from import output_notebook, show, curdoc
from bokeh.themes import Theme, default
import yaml

theme = Theme(json={'attrs': {'Plot': {'background_fill_color': 'pink'}}})
curdoc().theme = theme

x1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y1 = [0, 8, 2, 4, 6, 9, 5, 6, 25, 28, 4]

p = figure(title='PINK PLOT')
p.scatter(x1, y1)

Looking at the _ModelInEmptyDocument context manager in, it appears that the new empty_doc forgets about the applied theme. Changing

    for ref in model.references():
        ref._document = None
    empty_doc = Document()


    for ref in model.references():
        ref._document = None
    empty_doc = Document(theme=doc.theme)

produces the desired results.

First time posting here. I apologize if I am breaking any protocols. Thank you.

jetilton added a commit to jetilton/bokeh that referenced this issue Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

5 participants