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

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

Comments

@user32000
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
@cedricporter
Copy link

same problem

@rubik
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?

@djpugh
Copy link
Contributor

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

@ghost
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 bokeh.io import output_notebook, show, curdoc
from bokeh.themes import Theme, default
import yaml

output_notebook()
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)
show(p)

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

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

to

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

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
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants