Export png of a layout(Bokeh Server)

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

global i

x=[2,3,4]

global X

X=[i*n for n in x]

print(X)

i=i/1.1

source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools="")

fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I'm not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

···

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone.....I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)...It's working beautifully....But I have a problem doing it in Bokeh Server....here is the minimal example of it:-

import numpy as np
import pandas as pd
from bokeh.io import show, output_file
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource, Select
from bokeh.plotting import figure
from bokeh.layouts import layout, widgetbox, column, row, gridplot
from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool
from bokeh.palettes import GnBu3, OrRd3
from bokeh.plotting import reset_output
from bokeh.io import export_png

source = ColumnDataSource({'x': , 'y': })
i=1.0
X=
def update():

  global i
  x=[2,3,4]
  global X
  X=[i*n for n in x]
  print(X)
  i=i/1.1
  source.data.update(x=X, y=[0.5, 1.5, 2.5])
  
curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label='k',title='Power ',toolbar_location="above",tools="")
fig.hbar(y='y', right='x',height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename="fig1.png")

curdoc().add_root(fig)
curdoc().title = "Live updating"

Please help me out as it is giving an error like this

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks @Bryan …it works perfectly…but I have a new problem with it if I add a button for downloading the screenshot…it is showing an error…I can post the minimal example and not the
full code…The warning is:-( The webdriver raised a TimeoutException while waiting for a ‘bokeh:idle’ event to signify that the layout has rendered. Something may have gone wrong. ).
Please help me out with this. Thanks in advance :slight_smile:

minimal code:

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

from bokeh.models.widgets import Button

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

global i

x=[2,3,4]

global X

X=[i*n for n in x]

print(X)

i=i/1.1

source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)

fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

button = Button(label=“Download”)

def download():

export_png(doc_layout, filename="fig.png")

controls = [button]

controls[0].on_click(download)

doc_layout= layout([[widgetbox(button)],[fig]],sizing_mode=‘fixed’)

curdoc().add_root(doc_layout)

curdoc().title = “Live updating”

···

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I reinstalled selenium and phantomjs and it works perfectly now…As for second point just wait for 10 seconds for the graph to appear as I have given 10 sec for update refresh.

···

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi!

I had the plotting on my to do list as well and I ran into the same problems.

In your last example you solved it by plotting the whole layout:

export_png(doc_layout, filename=“fig.png”)

``

But if I try to only plot the figure (not the whole layout), I get the same error you posted before:

export_png(fig, filename=“fig.png”)

``


What I observed is the following:

It matters whether we try to plot before or after the following line is executed:

curdoc().add_root(doc_layout)

``

Before adding the layout to the root, exporting “fig” works. But not afterwards.

This observation is consistent in my own project, as well as the two examples you posted.

Is this behaviour expected, or is it a bug?

Regards

···

Am Donnerstag, 14. Dezember 2017 09:45:36 UTC+1 schrieb sai jena:

I reinstalled selenium and phantomjs and it works perfectly now…As for second point just wait for 10 seconds for the graph to appear as I have given 10 sec for update refresh.

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi @Joris …it is expected I guess. That is the reason why everything is executed before the curdoc().add_root(). I am getting the error while using fig as well as whole layout.

Regards

Sai Jena

···

On Thursday, December 14, 2017 at 4:11:10 PM UTC+5:30, Joris Nettelstroth wrote:

Hi!

I had the plotting on my to do list as well and I ran into the same problems.

In your last example you solved it by plotting the whole layout:

export_png(doc_layout, filename=“fig.png”)

``

But if I try to only plot the figure (not the whole layout), I get the same error you posted before:

export_png(fig, filename=“fig.png”)

``


What I observed is the following:

It matters whether we try to plot before or after the following line is executed:

curdoc().add_root(doc_layout)

``

Before adding the layout to the root, exporting “fig” works. But not afterwards.

This observation is consistent in my own project, as well as the two examples you posted.

Is this behaviour expected, or is it a bug?

Regards

Am Donnerstag, 14. Dezember 2017 09:45:36 UTC+1 schrieb sai jena:

I reinstalled selenium and phantomjs and it works perfectly now…As for second point just wait for 10 seconds for the graph to appear as I have given 10 sec for update refresh.

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

@Bryan Can you rectify the mistake for which it is showing such error or else give a minimal example of bokeh server having layout as the .png output. Thanks in advance

Regards

···

On Thursday, December 14, 2017 at 2:08:13 PM UTC+5:30, sai jena wrote:

Thanks @Bryan …it works perfectly…but I have a new problem with it if I add a button for downloading the screenshot…it is showing an error…I can post the minimal example and not the
full code…The warning is:-( The webdriver raised a TimeoutException while waiting for a ‘bokeh:idle’ event to signify that the layout has rendered. Something may have gone wrong. ).
Please help me out with this. Thanks in advance :slight_smile:

minimal code:

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

from bokeh.models.widgets import Button

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

global i

x=[2,3,4]

global X

X=[i*n for n in x]

print(X)

i=i/1.1

source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)

fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

button = Button(label=“Download”)

def download():

export_png(doc_layout, filename=“fig.png”)

controls = [button]

controls[0].on_click(download)

doc_layout= layout([[widgetbox(button)],[fig]],sizing_mode=‘fixed’)

curdoc().add_root(doc_layout)

curdoc().title = “Live updating”

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Sai,

you said you get the error while exporting the whole layout? For me, this actually works. It is just the figure that does not work.

There is already a github issue: WebDriverException when using export_png · Issue #7168 · bokeh/bokeh · GitHub

I have posted the following gist there, which prints to the console what is working and what isn’t: https://gist.github.com/AzraelDD/c4573f531fbc52cf5d0811d81d30a3fa

Please see if it gives the same output for you that I get:

doc_layout works
fig works
Layout is added to root
doc_layout works
fig throws error

``

Plus: on the press of the button, the layout is succesfully saved. (Bokeh 0.12.13)

···

Am Freitag, 15. Dezember 2017 10:12:16 UTC+1 schrieb sai jena:

@Bryan Can you rectify the mistake for which it is showing such error or else give a minimal example of bokeh server having layout as the .png output. Thanks in advance

Regards

On Thursday, December 14, 2017 at 2:08:13 PM UTC+5:30, sai jena wrote:

Thanks @Bryan …it works perfectly…but I have a new problem with it if I add a button for downloading the screenshot…it is showing an error…I can post the minimal example and not the
full code…The warning is:-( The webdriver raised a TimeoutException while waiting for a ‘bokeh:idle’ event to signify that the layout has rendered. Something may have gone wrong. ).
Please help me out with this. Thanks in advance :slight_smile:

minimal code:

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

from bokeh.models.widgets import Button

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

global i
x=[2,3,4]
global X
X=[i*n for n in x]
print(X)
i=i/1.1
source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)

fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

button = Button(label=“Download”)

def download():

export_png(doc_layout, filename="fig.png")

controls = [button]

controls[0].on_click(download)

doc_layout= layout([[widgetbox(button)],[fig]],sizing_mode=‘fixed’)

curdoc().add_root(doc_layout)

curdoc().title = “Live updating”

On Thursday, December 14, 2017 at 12:50:15 AM UTC+5:30, Bryan Van de ven wrote:

Hi,

Two observations:

First, your code correctly produces a fig1.png for me. So my guess is that the server wherever you are running this has an incompatible version of phantoms or possibly node.

Second, the fig1.png is of an empty (blank) plot. The export_png function is only called once, before any data, so an empty plot is completely expected, given the code as it is. I’m not sure if your code is simplified for demonstration but I wanted to point it out.

Thanks,

Bryan

On Dec 13, 2017, at 01:39, [email protected] wrote:

Hello everyone…I installed PhantomJS and tried exporting png of the bokeh layout through IPython(Jupyter)…It’s working beautifully…But I have a problem doing it in Bokeh Server…here is the minimal example of it:-

import numpy as np

import pandas as pd

from bokeh.io import show, output_file

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource, Select

from bokeh.plotting import figure

from bokeh.layouts import layout, widgetbox, column, row, gridplot

from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool

from bokeh.palettes import GnBu3, OrRd3

from bokeh.plotting import reset_output

from bokeh.io import export_png

source = ColumnDataSource({‘x’: , ‘y’: })

i=1.0

X=

def update():

    global i
    x=[2,3,4]
    global X
    X=[i*n for n in x]
    print(X)
    i=i/1.1
    source.data.update(x=X, y=[0.5, 1.5, 2.5])

curdoc().add_periodic_callback(update,10000)

fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools=“”)
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)

export_png(fig, filename=“fig1.png”)

curdoc().add_root(fig)

curdoc().title = “Live updating”

Please help me out as it is giving an error like this


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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/04bc575e-d78b-4519-87fd-0ad67cef94a9%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.