How to load image in Bokeh App

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

1 Like

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

···

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

  https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

···

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:

I also tried the code from the example but no luck so far...

import numpy as np
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Image
from bokeh.plotting import show
from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(
    url = [url]
))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(
    title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
    h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)
plot.add_glyph(image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file
from bokeh.models import ColumnDataSource

output_file('image.html')

url = r'C:\foo.png'

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
show(p)

....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,
Rakesh

--
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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi,

Thank you for the quick reply.
ImageURL I also tried inside the bokeh app.
No luck sofar.
I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,
Rakesh

···

On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

   https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:

I also tried the code from the example but no luck so far...

import numpy as np
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Image
from bokeh.plotting import show
from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(
   url = [url]
))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(
   title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
   h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)
plot.add_glyph(image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file
from bokeh.models import ColumnDataSource

output_file('image.html')

url = r'C:\foo.png'

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
show(p)

....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,
Rakesh

--
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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?

Bryan

···

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:

Hi,

Thank you for the quick reply.
ImageURL I also tried inside the bokeh app.
No luck sofar.
I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,
Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

  https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:

I also tried the code from the example but no luck so far...

import numpy as np
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Image
from bokeh.plotting import show
from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(
  url = [url]
))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(
  title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
  h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)
plot.add_glyph(image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file
from bokeh.models import ColumnDataSource

output_file('image.html')

url = r'C:\foo.png'

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
show(p)

....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,
Rakesh

--
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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.

···

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

···

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
--------------------

from os.path import dirname, join

from bokeh.models.glyphs import ImageURL
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
from bokeh.io import curdoc
from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(__file__), 'logo.png')

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)

image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
plot.add_glyph(source, image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title='tab1')

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?

Bryan

> On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:
>
> Hi,
>
> Thank you for the quick reply.
> ImageURL I also tried inside the bokeh app.
> No luck sofar.
> I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.
>
> Best wishes,
> Rakesh
>
>> On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:
>>
>> Hi,
>>
>> Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.
>>
>> https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py
>>
>> Thanks,
>>
>> Bryan
>>
>>> On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:
>>>
>>> I also tried the code from the example but no luck so far...
>>>
>>> import numpy as np
>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
>>> from bokeh.models.glyphs import Image
>>> from bokeh.plotting import show
>>> from bokeh.io import show, output_notebook
>>>
>>> url = r"C:\foo.png"
>>>
>>> output_notebook()
>>>
>>> source = ColumnDataSource(dict(
>>> url = [url]
>>> ))
>>>
>>> xdr = Range1d(start=0, end=1)
>>> ydr = Range1d(start=0, end=1)
>>>
>>> plot = Plot(
>>> title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
>>> h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
>>>
>>> image1 = Image(image=url)
>>> plot.add_glyph(image1)
>>>
>>> xaxis = LinearAxis()
>>> plot.add_layout(xaxis, 'below')
>>>
>>> yaxis = LinearAxis()
>>> plot.add_layout(yaxis,'left')
>>>
>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
>>>
>>> show(plot)
>>>
>>> On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
>>> Hi,
>>>
>>> I wish to plot an image from url. The following code works fine inside a notebook.
>>>
>>> from bokeh.plotting import Figure, show, output_file
>>> from bokeh.models import ColumnDataSource
>>>
>>> output_file('image.html')
>>>
>>> url = r'C:\foo.png'
>>>
>>> source = ColumnDataSource(dict(url = [url]))
>>>
>>> p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
>>> p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
>>> show(p)
>>>
>>> ....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.
>>>
>>> Any help here is much appreciated.
>>>
>>> Best wishes,
>>> Rakesh
>>>
>>> --
>>> 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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>
>>>
>>> --
>>> 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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>
>> --
>> 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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
> --
> 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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

···

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
--------------------

from os.path import dirname, join

from bokeh.models.glyphs import ImageURL
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
from bokeh.io import curdoc
from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(__file__), 'logo.png')

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)

image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
plot.add_glyph(source, image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title='tab1')

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:

Hi,

Thank you for the quick reply.
ImageURL I also tried inside the bokeh app.
No luck sofar.
I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,
Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:

I also tried the code from the example but no luck so far...

import numpy as np
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Image
from bokeh.plotting import show
from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(
url = [url]
))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(
title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)
plot.add_glyph(image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file
from bokeh.models import ColumnDataSource

output_file('image.html')

url = r'C:\foo.png'

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
show(p)

....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,
Rakesh

--
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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?
So basically loading from file is not possible?

···

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn't give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.
"C:\Users\Rakesh\Desktop\app\logo.png". pathname for the logo.

Does it work on you side?
So you are suggesting to make this png an http url?
So basically loading from file is not possible?

I'm not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser's JS console? Are there any 404's reported?

Bryan

···

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <[email protected]> wrote:

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <[email protected]> wrote:
In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

> On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:
>
> Rakesh,
>
> But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?
>
> Bryan
>
>
>> On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:
>>
>> Hi Bryan,
>>
>> See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
>> --------------------
>>
>> from os.path import dirname, join
>>
>> from bokeh.models.glyphs import ImageURL
>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
>> from bokeh.io import curdoc
>> from bokeh.models.widgets import Panel, Tabs, Paragraph
>>
>> url = join(dirname(__file__), 'logo.png')
>>
>> source = ColumnDataSource(dict(url = [url]))
>>
>> xdr = Range1d(start=0, end=1)
>> ydr = Range1d(start=0, end=1)
>>
>> plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)
>>
>> image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
>> plot.add_glyph(source, image1)
>>
>> xaxis = LinearAxis()
>> plot.add_layout(xaxis, 'below')
>>
>> yaxis = LinearAxis()
>> plot.add_layout(yaxis,'left')
>>
>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
>>
>> p1 = VBox(Paragraph(width=50), plot, width=800, height=600)
>>
>> tab1 = Panel(child=p1, title='tab1')
>>
>> tabs = Tabs(tabs=[tab1])
>>
>> curdoc().add_root(tabs)
>>
>> On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:
>>
>> Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?
>>
>> Bryan
>>
>>> On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> Thank you for the quick reply.
>>> ImageURL I also tried inside the bokeh app.
>>> No luck sofar.
>>> I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.
>>>
>>> Best wishes,
>>> Rakesh
>>>
>>>> On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.
>>>>
>>>> https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py
>>>>
>>>> Thanks,
>>>>
>>>> Bryan
>>>>
>>>>> On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:
>>>>>
>>>>> I also tried the code from the example but no luck so far...
>>>>>
>>>>> import numpy as np
>>>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
>>>>> from bokeh.models.glyphs import Image
>>>>> from bokeh.plotting import show
>>>>> from bokeh.io import show, output_notebook
>>>>>
>>>>> url = r"C:\foo.png"
>>>>>
>>>>> output_notebook()
>>>>>
>>>>> source = ColumnDataSource(dict(
>>>>> url = [url]
>>>>> ))
>>>>>
>>>>> xdr = Range1d(start=0, end=1)
>>>>> ydr = Range1d(start=0, end=1)
>>>>>
>>>>> plot = Plot(
>>>>> title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
>>>>> h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
>>>>>
>>>>> image1 = Image(image=url)
>>>>> plot.add_glyph(image1)
>>>>>
>>>>> xaxis = LinearAxis()
>>>>> plot.add_layout(xaxis, 'below')
>>>>>
>>>>> yaxis = LinearAxis()
>>>>> plot.add_layout(yaxis,'left')
>>>>>
>>>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
>>>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
>>>>>
>>>>> show(plot)
>>>>>
>>>>> On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
>>>>> Hi,
>>>>>
>>>>> I wish to plot an image from url. The following code works fine inside a notebook.
>>>>>
>>>>> from bokeh.plotting import Figure, show, output_file
>>>>> from bokeh.models import ColumnDataSource
>>>>>
>>>>> output_file('image.html')
>>>>>
>>>>> url = r'C:\foo.png'
>>>>>
>>>>> source = ColumnDataSource(dict(url = [url]))
>>>>>
>>>>> p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
>>>>> p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
>>>>> show(p)
>>>>>
>>>>> ....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.
>>>>>
>>>>> Any help here is much appreciated.
>>>>>
>>>>> Best wishes,
>>>>> Rakesh
>>>>>
>>>>> --
>>>>> 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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>>
>>>>>
>>>>> --
>>>>> 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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>
>>>> --
>>>> 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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>
>>> --
>>> 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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>
>> --
>> 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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>
>>
>> --
>> 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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>

--
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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

ahh sorry forget to answer that (for the third time already :slight_smile: )
No errors, no 404. Below the info from the console.

The chrome browser opens up and an empty graph is displayed.

C:\Users\Rakesh\Desktop>bokeh serve --show app

DEBUG:bokeh.server.tornado:Allowed Host headers: [‘localhost:5006’]

DEBUG:bokeh.server.tornado:These host origins can connect to the websocket: ['lo

calhost:5006’]

DEBUG:bokeh.server.tornado:Patterns are: [(‘/app/?’, <class 'bokeh.server.views.

doc_handler.DocHandler’>, {‘application_context’: <bokeh.server.application_cont

ext.ApplicationContext object at 0x000000F544AE5048>, ‘bokeh_websocket_path’: '/

app/ws’}), (‘/app/ws’, <class ‘bokeh.server.views.ws.WSHandler’>, {'application_

context’: <bokeh.server.application_context.ApplicationContext object at 0x00000

0F544AE5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/app/autoload.js’, <class ’

bokeh.server.views.autoload_js_handler.AutoloadJsHandler’>, {'application_contex

t’: <bokeh.server.application_context.ApplicationContext object at 0x000000F544A

E5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/static/(.*)’, <class 'bokeh.serv

er.views.static_handler.StaticHandler’>)]

INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with app

lications at paths [‘/app’]

INFO:tornado.access:200 GET /app (::1) 55.00ms

INFO:bokeh.server.views.ws:WebSocket connection opened

DEBUG:bokeh.server.views.ws:Receiver created for Protocol(‘1.0’)

DEBUG:bokeh.server.views.ws:ServerHandler created for Protocol(‘1.0’)

INFO:bokeh.server.views.ws:ServerConnection created

DEBUG:bokeh.server.session:Sending pull-doc-reply from session 'aJ7I08zAXP9J3ZSZ

CGqDgbtolnYiqkZ8NNTIUz6bEdlc’

INFO:bokeh.server.views.ws:WebSocket connection closed: code=None, reason=None

···

On Thu, Jun 23, 2016 at 11:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/23874B67-309E-4CF7-B062-F9AA7F627688%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Ok, the first problem is that you don't put "file://" in the URL. Without this, the browser tries to load from a relative URL on the bokeh server, and this fails with a 404. However, even putting in that, then I see a different error in the JS console:

  Not allowed to load local resource: file:///private/tmp/logo.png

The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app "static" directory, with this feature you can have the bokeh server serve your .png and then it will work.

Bryan

···

On Jun 23, 2016, at 4:33 PM, Bryan Van de Ven <[email protected]> wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <[email protected]> wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn't give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.
"C:\Users\Rakesh\Desktop\app\logo.png". pathname for the logo.

Does it work on you side?
So you are suggesting to make this png an http url?
So basically loading from file is not possible?

I'm not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser's JS console? Are there any 404's reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <[email protected]> wrote:
In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
--------------------

from os.path import dirname, join

from bokeh.models.glyphs import ImageURL
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
from bokeh.io import curdoc
from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(__file__), 'logo.png')

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)

image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
plot.add_glyph(source, image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title='tab1')

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:

Hi,

Thank you for the quick reply.
ImageURL I also tried inside the bokeh app.
No luck sofar.
I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,
Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:

I also tried the code from the example but no luck so far...

import numpy as np
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Image
from bokeh.plotting import show
from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(
url = [url]
))

xdr = Range1d(start=0, end=1)
ydr = Range1d(start=0, end=1)

plot = Plot(
title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)
plot.add_glyph(image1)

xaxis = LinearAxis()
plot.add_layout(xaxis, 'below')

yaxis = LinearAxis()
plot.add_layout(yaxis,'left')

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file
from bokeh.models import ColumnDataSource

output_file('image.html')

url = r'C:\foo.png'

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
show(p)

....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,
Rakesh

--
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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

FYI that is the shell console log, I was asking about the JS console log in your web browser. You might have to enable some "dev tools" (but see my other answer first)

Bryan

···

On Jun 23, 2016, at 4:38 PM, Rakesh Partapsing <[email protected]> wrote:

ahh sorry forget to answer that (for the third time already :slight_smile: )
No errors, no 404. Below the info from the console.
The chrome browser opens up and an empty graph is displayed.

C:\Users\Rakesh\Desktop>bokeh serve --show app
DEBUG:bokeh.server.tornado:Allowed Host headers: ['localhost:5006']
DEBUG:bokeh.server.tornado:These host origins can connect to the websocket: ['lo
calhost:5006']
DEBUG:bokeh.server.tornado:Patterns are: [('/app/?', <class 'bokeh.server.views.
doc_handler.DocHandler'>, {'application_context': <bokeh.server.application_cont
ext.ApplicationContext object at 0x000000F544AE5048>, 'bokeh_websocket_path': '/
app/ws'}), ('/app/ws', <class 'bokeh.server.views.ws.WSHandler'>, {'application_
context': <bokeh.server.application_context.ApplicationContext object at 0x00000
0F544AE5048>, 'bokeh_websocket_path': '/app/ws'}), ('/app/autoload.js', <class '
bokeh.server.views.autoload_js_handler.AutoloadJsHandler'>, {'application_contex
t': <bokeh.server.application_context.ApplicationContext object at 0x000000F544A
E5048>, 'bokeh_websocket_path': '/app/ws'}), ('/static/(.*)', <class 'bokeh.serv
er.views.static_handler.StaticHandler'>)]
INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with app
lications at paths ['/app']
INFO:tornado.access:200 GET /app (::1) 55.00ms
INFO:bokeh.server.views.ws:WebSocket connection opened
DEBUG:bokeh.server.views.ws:Receiver created for Protocol('1.0')
DEBUG:bokeh.server.views.ws:ServerHandler created for Protocol('1.0')
INFO:bokeh.server.views.ws:ServerConnection created
DEBUG:bokeh.server.session:Sending pull-doc-reply from session 'aJ7I08zAXP9J3ZSZ
CGqDgbtolnYiqkZ8NNTIUz6bEdlc'
INFO:bokeh.server.views.ws:WebSocket connection closed: code=None, reason=None

On Thu, Jun 23, 2016 at 11:33 PM, Bryan Van de Ven <[email protected]> wrote:

> On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <[email protected]> wrote:
>
> Hi Bryan,
>
> I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn't give me that impression, but neither did I want to assume that.

> All is on one machine inside the same folder.
> "C:\Users\Rakesh\Desktop\app\logo.png". pathname for the logo.
>
> Does it work on you side?
> So you are suggesting to make this png an http url?
> So basically loading from file is not possible?

I'm not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser's JS console? Are there any 404's reported?

Bryan

>
>
> On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <[email protected]> wrote:
> In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.
>
> Bryan
>
> > On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:
> >
> > Rakesh,
> >
> > But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?
> >
> > Bryan
> >
> >
> >> On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:
> >>
> >> Hi Bryan,
> >>
> >> See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
> >> --------------------
> >>
> >> from os.path import dirname, join
> >>
> >> from bokeh.models.glyphs import ImageURL
> >> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
> >> from bokeh.io import curdoc
> >> from bokeh.models.widgets import Panel, Tabs, Paragraph
> >>
> >> url = join(dirname(__file__), 'logo.png')
> >>
> >> source = ColumnDataSource(dict(url = [url]))
> >>
> >> xdr = Range1d(start=0, end=1)
> >> ydr = Range1d(start=0, end=1)
> >>
> >> plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)
> >>
> >> image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
> >> plot.add_glyph(source, image1)
> >>
> >> xaxis = LinearAxis()
> >> plot.add_layout(xaxis, 'below')
> >>
> >> yaxis = LinearAxis()
> >> plot.add_layout(yaxis,'left')
> >>
> >> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
> >> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
> >>
> >> p1 = VBox(Paragraph(width=50), plot, width=800, height=600)
> >>
> >> tab1 = Panel(child=p1, title='tab1')
> >>
> >> tabs = Tabs(tabs=[tab1])
> >>
> >> curdoc().add_root(tabs)
> >>
> >> On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:
> >>
> >> Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?
> >>
> >> Bryan
> >>
> >>> On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:
> >>>
> >>> Hi,
> >>>
> >>> Thank you for the quick reply.
> >>> ImageURL I also tried inside the bokeh app.
> >>> No luck sofar.
> >>> I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.
> >>>
> >>> Best wishes,
> >>> Rakesh
> >>>
> >>>> On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.
> >>>>
> >>>> https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Bryan
> >>>>
> >>>>> On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:
> >>>>>
> >>>>> I also tried the code from the example but no luck so far...
> >>>>>
> >>>>> import numpy as np
> >>>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
> >>>>> from bokeh.models.glyphs import Image
> >>>>> from bokeh.plotting import show
> >>>>> from bokeh.io import show, output_notebook
> >>>>>
> >>>>> url = r"C:\foo.png"
> >>>>>
> >>>>> output_notebook()
> >>>>>
> >>>>> source = ColumnDataSource(dict(
> >>>>> url = [url]
> >>>>> ))
> >>>>>
> >>>>> xdr = Range1d(start=0, end=1)
> >>>>> ydr = Range1d(start=0, end=1)
> >>>>>
> >>>>> plot = Plot(
> >>>>> title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
> >>>>> h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
> >>>>>
> >>>>> image1 = Image(image=url)
> >>>>> plot.add_glyph(image1)
> >>>>>
> >>>>> xaxis = LinearAxis()
> >>>>> plot.add_layout(xaxis, 'below')
> >>>>>
> >>>>> yaxis = LinearAxis()
> >>>>> plot.add_layout(yaxis,'left')
> >>>>>
> >>>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
> >>>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
> >>>>>
> >>>>> show(plot)
> >>>>>
> >>>>> On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
> >>>>> Hi,
> >>>>>
> >>>>> I wish to plot an image from url. The following code works fine inside a notebook.
> >>>>>
> >>>>> from bokeh.plotting import Figure, show, output_file
> >>>>> from bokeh.models import ColumnDataSource
> >>>>>
> >>>>> output_file('image.html')
> >>>>>
> >>>>> url = r'C:\foo.png'
> >>>>>
> >>>>> source = ColumnDataSource(dict(url = [url]))
> >>>>>
> >>>>> p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
> >>>>> p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
> >>>>> show(p)
> >>>>>
> >>>>> ....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.
> >>>>>
> >>>>> Any help here is much appreciated.
> >>>>>
> >>>>> Best wishes,
> >>>>> Rakesh
> >>>>>
> >>>>> --
> >>>>> 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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
> >>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>>>>
> >>>>>
> >>>>> --
> >>>>> 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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
> >>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>>>
> >>>> --
> >>>> 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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
> >>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>>
> >>> --
> >>> 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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
> >>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>
> >> --
> >> 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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
> >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >>
> >>
> >> --
> >> 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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
> >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
>
> --
> 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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/23874B67-309E-4CF7-B062-F9AA7F627688%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf63bSfgsnBgYVtA%3DU%3Di2voZixcrHse9ebWLU1XukqueXEA%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks Bryan.

Let’s await 0.12 release. Ah JS console log, good to know for future reference.

control+shift+J opens up the log (windows/chrome). This seems to be enabled by default. I observe the same error.

Greetings,

Rakesh

···

On Thu, Jun 23, 2016 at 11:39 PM, Bryan Van de Ven [email protected] wrote:

FYI that is the shell console log, I was asking about the JS console log in your web browser. You might have to enable some “dev tools” (but see my other answer first)

Bryan

On Jun 23, 2016, at 4:38 PM, Rakesh Partapsing [email protected] wrote:

ahh sorry forget to answer that (for the third time already :slight_smile: )

No errors, no 404. Below the info from the console.

The chrome browser opens up and an empty graph is displayed.

C:\Users\Rakesh\Desktop>bokeh serve --show app

DEBUG:bokeh.server.tornado:Allowed Host headers: [‘localhost:5006’]

DEBUG:bokeh.server.tornado:These host origins can connect to the websocket: ['lo

calhost:5006’]

DEBUG:bokeh.server.tornado:Patterns are: [(‘/app/?’, <class 'bokeh.server.views.

doc_handler.DocHandler’>, {‘application_context’: <bokeh.server.application_cont

ext.ApplicationContext object at 0x000000F544AE5048>, ‘bokeh_websocket_path’: '/

app/ws’}), (‘/app/ws’, <class ‘bokeh.server.views.ws.WSHandler’>, {'application_

context’: <bokeh.server.application_context.ApplicationContext object at 0x00000

0F544AE5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/app/autoload.js’, <class ’

bokeh.server.views.autoload_js_handler.AutoloadJsHandler’>, {'application_contex

t’: <bokeh.server.application_context.ApplicationContext object at 0x000000F544A

E5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/static/(.*)’, <class 'bokeh.serv

er.views.static_handler.StaticHandler’>)]

INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with app

lications at paths [‘/app’]

INFO:tornado.access:200 GET /app (::1) 55.00ms

INFO:bokeh.server.views.ws:WebSocket connection opened

DEBUG:bokeh.server.views.ws:Receiver created for Protocol(‘1.0’)

DEBUG:bokeh.server.views.ws:ServerHandler created for Protocol(‘1.0’)

INFO:bokeh.server.views.ws:ServerConnection created

DEBUG:bokeh.server.session:Sending pull-doc-reply from session 'aJ7I08zAXP9J3ZSZ

CGqDgbtolnYiqkZ8NNTIUz6bEdlc’

INFO:bokeh.server.views.ws:WebSocket connection closed: code=None, reason=None

On Thu, Jun 23, 2016 at 11:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/23874B67-309E-4CF7-B062-F9AA7F627688%40continuum.io.

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

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/CAKGpf63bSfgsnBgYVtA%3DU%3Di2voZixcrHse9ebWLU1XukqueXEA%40mail.gmail.com.

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

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/87D86A44-D818-453C-915E-14D86E749F88%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

In you earlier post you mentioned that Image object only takes an array.

Now that I converted my image to a numpy array, passing it through Image I get the following error:

       expected an element of either String, Dict(String, Either(String, Float)) or Float, got array([[ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
[ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
[ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
..., [ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
[ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
[ 0.74609375, 0.74609375, 0.74609375, 0.99609375]])
···

On Thu, Jun 23, 2016 at 11:39 PM, Bryan Van de Ven [email protected] wrote:

FYI that is the shell console log, I was asking about the JS console log in your web browser. You might have to enable some “dev tools” (but see my other answer first)

Bryan

On Jun 23, 2016, at 4:38 PM, Rakesh Partapsing [email protected] wrote:

ahh sorry forget to answer that (for the third time already :slight_smile: )

No errors, no 404. Below the info from the console.

The chrome browser opens up and an empty graph is displayed.

C:\Users\Rakesh\Desktop>bokeh serve --show app

DEBUG:bokeh.server.tornado:Allowed Host headers: [‘localhost:5006’]

DEBUG:bokeh.server.tornado:These host origins can connect to the websocket: ['lo

calhost:5006’]

DEBUG:bokeh.server.tornado:Patterns are: [(‘/app/?’, <class 'bokeh.server.views.

doc_handler.DocHandler’>, {‘application_context’: <bokeh.server.application_cont

ext.ApplicationContext object at 0x000000F544AE5048>, ‘bokeh_websocket_path’: '/

app/ws’}), (‘/app/ws’, <class ‘bokeh.server.views.ws.WSHandler’>, {'application_

context’: <bokeh.server.application_context.ApplicationContext object at 0x00000

0F544AE5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/app/autoload.js’, <class ’

bokeh.server.views.autoload_js_handler.AutoloadJsHandler’>, {'application_contex

t’: <bokeh.server.application_context.ApplicationContext object at 0x000000F544A

E5048>, ‘bokeh_websocket_path’: ‘/app/ws’}), (‘/static/(.*)’, <class 'bokeh.serv

er.views.static_handler.StaticHandler’>)]

INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with app

lications at paths [‘/app’]

INFO:tornado.access:200 GET /app (::1) 55.00ms

INFO:bokeh.server.views.ws:WebSocket connection opened

DEBUG:bokeh.server.views.ws:Receiver created for Protocol(‘1.0’)

DEBUG:bokeh.server.views.ws:ServerHandler created for Protocol(‘1.0’)

INFO:bokeh.server.views.ws:ServerConnection created

DEBUG:bokeh.server.session:Sending pull-doc-reply from session 'aJ7I08zAXP9J3ZSZ

CGqDgbtolnYiqkZ8NNTIUz6bEdlc’

INFO:bokeh.server.views.ws:WebSocket connection closed: code=None, reason=None

On Thu, Jun 23, 2016 at 11:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/23874B67-309E-4CF7-B062-F9AA7F627688%40continuum.io.

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

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/CAKGpf63bSfgsnBgYVtA%3DU%3Di2voZixcrHse9ebWLU1XukqueXEA%40mail.gmail.com.

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

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/87D86A44-D818-453C-915E-14D86E749F88%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Image takes an array as a particular parameter (see glyphs — Bokeh 3.3.2 Documentation). That error indicates that you are passing it to the wrong parameter, but I can't speculate what your usage error might be unless you provide some code to look.

As a genreal note, one of the best ways to get started using Bokeh is to take one of the many existing working examples in the user's guide and gallery and examples folder, and to learn about how to use things by modifying it slightly. Here's an example that draws an image using the bokeh.plotting API, which is probably easier that using the low-level Image object directly:

  http://bokeh.pydata.org/en/latest/docs/gallery/image.html

Thanks,

Bryan

···

On Jun 24, 2016, at 4:14 AM, Rakesh Partapsing <[email protected]> wrote:

Hi Bryan,

In you earlier post you mentioned that Image object only takes an array.
Now that I converted my image to a numpy array, passing it through Image I get the following error:

expected an element of either String, Dict(String, Either(String, Float)) or Float, got array([[ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
       [ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
       [ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
       ...,
       [ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
       [ 0.74609375, 0.74609375, 0.74609375, 0.99609375],
       [ 0.74609375, 0.74609375, 0.74609375, 0.99609375]])

On Thu, Jun 23, 2016 at 11:39 PM, Bryan Van de Ven <[email protected]> wrote:
FYI that is the shell console log, I was asking about the JS console log in your web browser. You might have to enable some "dev tools" (but see my other answer first)

Bryan

> On Jun 23, 2016, at 4:38 PM, Rakesh Partapsing <[email protected]> wrote:
>
> ahh sorry forget to answer that (for the third time already :slight_smile: )
> No errors, no 404. Below the info from the console.
> The chrome browser opens up and an empty graph is displayed.
>
> C:\Users\Rakesh\Desktop>bokeh serve --show app
> DEBUG:bokeh.server.tornado:Allowed Host headers: ['localhost:5006']
> DEBUG:bokeh.server.tornado:These host origins can connect to the websocket: ['lo
> calhost:5006']
> DEBUG:bokeh.server.tornado:Patterns are: [('/app/?', <class 'bokeh.server.views.
> doc_handler.DocHandler'>, {'application_context': <bokeh.server.application_cont
> ext.ApplicationContext object at 0x000000F544AE5048>, 'bokeh_websocket_path': '/
> app/ws'}), ('/app/ws', <class 'bokeh.server.views.ws.WSHandler'>, {'application_
> context': <bokeh.server.application_context.ApplicationContext object at 0x00000
> 0F544AE5048>, 'bokeh_websocket_path': '/app/ws'}), ('/app/autoload.js', <class '
> bokeh.server.views.autoload_js_handler.AutoloadJsHandler'>, {'application_contex
> t': <bokeh.server.application_context.ApplicationContext object at 0x000000F544A
> E5048>, 'bokeh_websocket_path': '/app/ws'}), ('/static/(.*)', <class 'bokeh.serv
> er.views.static_handler.StaticHandler'>)]
> INFO:bokeh.command.subcommands.serve:Starting Bokeh server on port 5006 with app
> lications at paths ['/app']
> INFO:tornado.access:200 GET /app (::1) 55.00ms
> INFO:bokeh.server.views.ws:WebSocket connection opened
> DEBUG:bokeh.server.views.ws:Receiver created for Protocol('1.0')
> DEBUG:bokeh.server.views.ws:ServerHandler created for Protocol('1.0')
> INFO:bokeh.server.views.ws:ServerConnection created
> DEBUG:bokeh.server.session:Sending pull-doc-reply from session 'aJ7I08zAXP9J3ZSZ
> CGqDgbtolnYiqkZ8NNTIUz6bEdlc'
> INFO:bokeh.server.views.ws:WebSocket connection closed: code=None, reason=None
>
> On Thu, Jun 23, 2016 at 11:33 PM, Bryan Van de Ven <[email protected]> wrote:
>
> > On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <[email protected]> wrote:
> >
> > Hi Bryan,
> >
> > I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.
>
> You didn't give me that impression, but neither did I want to assume that.
>
> > All is on one machine inside the same folder.
> > "C:\Users\Rakesh\Desktop\app\logo.png". pathname for the logo.
> >
> > Does it work on you side?
> > So you are suggesting to make this png an http url?
> > So basically loading from file is not possible?
>
> I'm not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser's JS console? Are there any 404's reported?
>
> Bryan
>
> >
> >
> > On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <[email protected]> wrote:
> > In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.
> >
> > Bryan
> >
> > > On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:
> > >
> > > Rakesh,
> > >
> > > But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?
> > >
> > > Bryan
> > >
> > >
> > >> On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:
> > >>
> > >> Hi Bryan,
> > >>
> > >> See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
> > >> --------------------
> > >>
> > >> from os.path import dirname, join
> > >>
> > >> from bokeh.models.glyphs import ImageURL
> > >> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
> > >> from bokeh.io import curdoc
> > >> from bokeh.models.widgets import Panel, Tabs, Paragraph
> > >>
> > >> url = join(dirname(__file__), 'logo.png')
> > >>
> > >> source = ColumnDataSource(dict(url = [url]))
> > >>
> > >> xdr = Range1d(start=0, end=1)
> > >> ydr = Range1d(start=0, end=1)
> > >>
> > >> plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)
> > >>
> > >> image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
> > >> plot.add_glyph(source, image1)
> > >>
> > >> xaxis = LinearAxis()
> > >> plot.add_layout(xaxis, 'below')
> > >>
> > >> yaxis = LinearAxis()
> > >> plot.add_layout(yaxis,'left')
> > >>
> > >> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
> > >> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
> > >>
> > >> p1 = VBox(Paragraph(width=50), plot, width=800, height=600)
> > >>
> > >> tab1 = Panel(child=p1, title='tab1')
> > >>
> > >> tabs = Tabs(tabs=[tab1])
> > >>
> > >> curdoc().add_root(tabs)
> > >>
> > >> On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:
> > >>
> > >> Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?
> > >>
> > >> Bryan
> > >>
> > >>> On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:
> > >>>
> > >>> Hi,
> > >>>
> > >>> Thank you for the quick reply.
> > >>> ImageURL I also tried inside the bokeh app.
> > >>> No luck sofar.
> > >>> I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.
> > >>>
> > >>> Best wishes,
> > >>> Rakesh
> > >>>
> > >>>> On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:
> > >>>>
> > >>>> Hi,
> > >>>>
> > >>>> Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.
> > >>>>
> > >>>> https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py
> > >>>>
> > >>>> Thanks,
> > >>>>
> > >>>> Bryan
> > >>>>
> > >>>>> On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:
> > >>>>>
> > >>>>> I also tried the code from the example but no luck so far...
> > >>>>>
> > >>>>> import numpy as np
> > >>>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
> > >>>>> from bokeh.models.glyphs import Image
> > >>>>> from bokeh.plotting import show
> > >>>>> from bokeh.io import show, output_notebook
> > >>>>>
> > >>>>> url = r"C:\foo.png"
> > >>>>>
> > >>>>> output_notebook()
> > >>>>>
> > >>>>> source = ColumnDataSource(dict(
> > >>>>> url = [url]
> > >>>>> ))
> > >>>>>
> > >>>>> xdr = Range1d(start=0, end=1)
> > >>>>> ydr = Range1d(start=0, end=1)
> > >>>>>
> > >>>>> plot = Plot(
> > >>>>> title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
> > >>>>> h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
> > >>>>>
> > >>>>> image1 = Image(image=url)
> > >>>>> plot.add_glyph(image1)
> > >>>>>
> > >>>>> xaxis = LinearAxis()
> > >>>>> plot.add_layout(xaxis, 'below')
> > >>>>>
> > >>>>> yaxis = LinearAxis()
> > >>>>> plot.add_layout(yaxis,'left')
> > >>>>>
> > >>>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
> > >>>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
> > >>>>>
> > >>>>> show(plot)
> > >>>>>
> > >>>>> On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
> > >>>>> Hi,
> > >>>>>
> > >>>>> I wish to plot an image from url. The following code works fine inside a notebook.
> > >>>>>
> > >>>>> from bokeh.plotting import Figure, show, output_file
> > >>>>> from bokeh.models import ColumnDataSource
> > >>>>>
> > >>>>> output_file('image.html')
> > >>>>>
> > >>>>> url = r'C:\foo.png'
> > >>>>>
> > >>>>> source = ColumnDataSource(dict(url = [url]))
> > >>>>>
> > >>>>> p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
> > >>>>> p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
> > >>>>> show(p)
> > >>>>>
> > >>>>> ....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.
> > >>>>>
> > >>>>> Any help here is much appreciated.
> > >>>>>
> > >>>>> Best wishes,
> > >>>>> Rakesh
> > >>>>>
> > >>>>> --
> > >>>>> 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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
> > >>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>>>>
> > >>>>>
> > >>>>> --
> > >>>>> 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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
> > >>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>>>
> > >>>> --
> > >>>> 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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
> > >>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>>
> > >>> --
> > >>> 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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
> > >>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>
> > >> --
> > >> 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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
> > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >>
> > >>
> > >> --
> > >> 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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
> > >> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> >
> > --
> > 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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
> --
> 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/23874B67-309E-4CF7-B062-F9AA7F627688%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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/CAKGpf63bSfgsnBgYVtA%3DU%3Di2voZixcrHse9ebWLU1XukqueXEA%40mail.gmail.com\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/87D86A44-D818-453C-915E-14D86E749F88%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf63p%3DxpcQQFrhQFj7sH%2B1f1Z4z%2BK3XbN1dEFX5j2Pcafaw%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Dear Bryan,

Upon this subject you mentioned:

“The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.”

I am still not able to load any .pngs from file using bokeh 0.12 when creating an app. Again same error in JSConsoleLog which is:
localhost/:1 Not allowed to load local resource: file:///C:/foo/bar.png

My code:

fSave = r"file:///C:\foo\bar.png"

src = ColumnDataSource(dict(url = [fSave]))

plot = Figure(plot_width=800, plot_height=400)

plot.x_range=Range1d(start=0, end=1)

plot.y_range=Range1d(start=0, end=1)

plot.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=src)

Can you guide to the correct way to load png’s from file into a bokeh app?

Greetings,

Rakesh

···

On Thu, Jun 23, 2016 at 11:38 PM, Bryan Van de Ven [email protected] wrote:

Ok, the first problem is that you don’t put “file://” in the URL. Without this, the browser tries to load from a relative URL on the bokeh server, and this fails with a 404. However, even putting in that, then I see a different error in the JS console:

    Not allowed to load local resource: file:///private/tmp/logo.png

The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.

Bryan

On Jun 23, 2016, at 4:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/6EF0C055-4D5E-41F2-88D1-4722D33F1EC5%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You'll need to:

* make a "directory" style app
* make a "static" subdirectoy in the app directory
* put all your pngs, etc in the "static" subdirectoy
* then anything in the static directory is available at the relative URL "myappname/static" (substitute whatever your actual app name is for "myappname")

Just to be clear, it's never going to be possible to load files from arbitrary filesystem locations like "C:/foo/bar.png", only from the application-specific "static" directory.

Bryan

···

On Jul 13, 2016, at 11:48 AM, Rakesh Partapsing <[email protected]> wrote:

Dear Bryan,

Upon this subject you mentioned:

"The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app "static" directory, with this feature you can have the bokeh server serve your .png and then it will work."

I am still not able to load any .pngs from file using bokeh 0.12 when creating an app. Again same error in JSConsoleLog which is:
localhost/:1 Not allowed to load local resource: file:///C:/foo/bar.png

My code:
fSave = r"file:///C:\foo\bar.png"

src = ColumnDataSource(dict(url = [fSave]))

plot = Figure(plot_width=800, plot_height=400)
plot.x_range=Range1d(start=0, end=1)
plot.y_range=Range1d(start=0, end=1)
plot.image_url(url='url', x=0, y=1, h=1, w=1, source=src)

Can you guide to the correct way to load png's from file into a bokeh app?

Greetings,
Rakesh

On Thu, Jun 23, 2016 at 11:38 PM, Bryan Van de Ven <[email protected]> wrote:
Ok, the first problem is that you don't put "file://" in the URL. Without this, the browser tries to load from a relative URL on the bokeh server, and this fails with a 404. However, even putting in that, then I see a different error in the JS console:

        Not allowed to load local resource: file:///private/tmp/logo.png

The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app "static" directory, with this feature you can have the bokeh server serve your .png and then it will work.

Bryan

> On Jun 23, 2016, at 4:33 PM, Bryan Van de Ven <[email protected]> wrote:
>
>
>> On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <[email protected]> wrote:
>>
>> Hi Bryan,
>>
>> I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.
>
> You didn't give me that impression, but neither did I want to assume that.
>
>> All is on one machine inside the same folder.
>> "C:\Users\Rakesh\Desktop\app\logo.png". pathname for the logo.
>>
>> Does it work on you side?
>> So you are suggesting to make this png an http url?
>> So basically loading from file is not possible?
>
> I'm not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser's JS console? Are there any 404's reported?
>
> Bryan
>
>>
>>
>> On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <[email protected]> wrote:
>> In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.
>>
>> Bryan
>>
>>> On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven <[email protected]> wrote:
>>>
>>> Rakesh,
>>>
>>> But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be *accessible* to the *browser*. If you can't type "file://some/path/logo.png" in the browser URL bar and see the image show up, then it won't work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?
>>>
>>> Bryan
>>>
>>>
>>>> On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing <[email protected]> wrote:
>>>>
>>>> Hi Bryan,
>>>>
>>>> See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called 'app'. command: bokeh serve --show app.
>>>> --------------------
>>>>
>>>> from os.path import dirname, join
>>>>
>>>> from bokeh.models.glyphs import ImageURL
>>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox
>>>> from bokeh.io import curdoc
>>>> from bokeh.models.widgets import Panel, Tabs, Paragraph
>>>>
>>>> url = join(dirname(__file__), 'logo.png')
>>>>
>>>> source = ColumnDataSource(dict(url = [url]))
>>>>
>>>> xdr = Range1d(start=0, end=1)
>>>> ydr = Range1d(start=0, end=1)
>>>>
>>>> plot = Plot(title="ImageURL", x_range=xdr, y_range=ydr)
>>>>
>>>> image1 = ImageURL(url="url", x=0, y=1, w=1, h=1, anchor="center", global_alpha=0.2)
>>>> plot.add_glyph(source, image1)
>>>>
>>>> xaxis = LinearAxis()
>>>> plot.add_layout(xaxis, 'below')
>>>>
>>>> yaxis = LinearAxis()
>>>> plot.add_layout(yaxis,'left')
>>>>
>>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
>>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
>>>>
>>>> p1 = VBox(Paragraph(width=50), plot, width=800, height=600)
>>>>
>>>> tab1 = Panel(child=p1, title='tab1')
>>>>
>>>> tabs = Tabs(tabs=[tab1])
>>>>
>>>> curdoc().add_root(tabs)
>>>>
>>>> On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven <[email protected]> wrote:
>>>>
>>>> Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It's a local file, are you viewing it on a remote machine. The URL has to be accessible to the *browser*. Are there any messages in the browser JS console?
>>>>
>>>> Bryan
>>>>
>>>>> On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing <[email protected]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Thank you for the quick reply.
>>>>> ImageURL I also tried inside the bokeh app.
>>>>> No luck sofar.
>>>>> I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.
>>>>>
>>>>> Best wishes,
>>>>> Rakesh
>>>>>
>>>>>> On 23 jun. 2016, at 17:52, Bryan Van de Ven <[email protected]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.
>>>>>>
>>>>>> https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Bryan
>>>>>>
>>>>>>> On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing <[email protected]> wrote:
>>>>>>>
>>>>>>> I also tried the code from the example but no luck so far...
>>>>>>>
>>>>>>> import numpy as np
>>>>>>> from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
>>>>>>> from bokeh.models.glyphs import Image
>>>>>>> from bokeh.plotting import show
>>>>>>> from bokeh.io import show, output_notebook
>>>>>>>
>>>>>>> url = r"C:\foo.png"
>>>>>>>
>>>>>>> output_notebook()
>>>>>>>
>>>>>>> source = ColumnDataSource(dict(
>>>>>>> url = [url]
>>>>>>> ))
>>>>>>>
>>>>>>> xdr = Range1d(start=0, end=1)
>>>>>>> ydr = Range1d(start=0, end=1)
>>>>>>>
>>>>>>> plot = Plot(
>>>>>>> title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,
>>>>>>> h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)
>>>>>>>
>>>>>>> image1 = Image(image=url)
>>>>>>> plot.add_glyph(image1)
>>>>>>>
>>>>>>> xaxis = LinearAxis()
>>>>>>> plot.add_layout(xaxis, 'below')
>>>>>>>
>>>>>>> yaxis = LinearAxis()
>>>>>>> plot.add_layout(yaxis,'left')
>>>>>>>
>>>>>>> plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
>>>>>>> plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))
>>>>>>>
>>>>>>> show(plot)
>>>>>>>
>>>>>>> On Thu, Jun 23, 2016 at 5:13 PM, Raki <[email protected]> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I wish to plot an image from url. The following code works fine inside a notebook.
>>>>>>>
>>>>>>> from bokeh.plotting import Figure, show, output_file
>>>>>>> from bokeh.models import ColumnDataSource
>>>>>>>
>>>>>>> output_file('image.html')
>>>>>>>
>>>>>>> url = r'C:\foo.png'
>>>>>>>
>>>>>>> source = ColumnDataSource(dict(url = [url]))
>>>>>>>
>>>>>>> p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)
>>>>>>> p.image_url(url='url', x=0, y=1, h=1, w=1, source=source)
>>>>>>> show(p)
>>>>>>>
>>>>>>> ....but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.
>>>>>>>
>>>>>>> Any help here is much appreciated.
>>>>>>>
>>>>>>> Best wishes,
>>>>>>> Rakesh
>>>>>>>
>>>>>>> --
>>>>>>> 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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io\.
>>>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com\.
>>>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>>>
>>>>>> --
>>>>>> 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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io\.
>>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>>
>>>>> --
>>>>> 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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com\.
>>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>
>>>> --
>>>> 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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io\.
>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>>
>>>>
>>>> --
>>>> 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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com\.
>>>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>>
>>
>> --
>> 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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>>
>>
>> --
>> 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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>

--
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/6EF0C055-4D5E-41F2-88D1-4722D33F1EC5%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/CAKGpf63uTASm0%2B2FVzSrrJqR7uEmv06rfMaPST4MmzqUJJ%3DDRA%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thank you, works like a charm!

···

On Wed, Jul 13, 2016 at 6:57 PM, Bryan Van de Ven [email protected] wrote:

You’ll need to:

  • make a “directory” style app

  • make a “static” subdirectoy in the app directory

  • put all your pngs, etc in the “static” subdirectoy

  • then anything in the static directory is available at the relative URL “myappname/static” (substitute whatever your actual app name is for “myappname”)

Just to be clear, it’s never going to be possible to load files from arbitrary filesystem locations like “C:/foo/bar.png”, only from the application-specific “static” directory.

Bryan

On Jul 13, 2016, at 11:48 AM, Rakesh Partapsing [email protected] wrote:

Dear Bryan,

Upon this subject you mentioned:

“The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.”

I am still not able to load any .pngs from file using bokeh 0.12 when creating an app. Again same error in JSConsoleLog which is:

localhost/:1 Not allowed to load local resource: file:///C:/foo/bar.png

My code:

fSave = r"file:///C:\foo\bar.png"

src = ColumnDataSource(dict(url = [fSave]))

plot = Figure(plot_width=800, plot_height=400)

plot.x_range=Range1d(start=0, end=1)

plot.y_range=Range1d(start=0, end=1)

plot.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=src)

Can you guide to the correct way to load png’s from file into a bokeh app?

Greetings,

Rakesh

On Thu, Jun 23, 2016 at 11:38 PM, Bryan Van de Ven [email protected] wrote:

Ok, the first problem is that you don’t put “file://” in the URL. Without this, the browser tries to load from a relative URL on the bokeh server, and this fails with a 404. However, even putting in that, then I see a different error in the JS console:

    Not allowed to load local resource: file:///private/tmp/logo.png

The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.

Bryan

On Jun 23, 2016, at 4:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/6EF0C055-4D5E-41F2-88D1-4722D33F1EC5%40continuum.io.

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

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/CAKGpf63uTASm0%2B2FVzSrrJqR7uEmv06rfMaPST4MmzqUJJ%3DDRA%40mail.gmail.com.

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

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/A69039E0-26A6-429A-9ADE-818EE0B5617F%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hello,
I have the same issue however I can not find a way to solve it…

Basically mycode looks like this:

div_img_html = “

div_img = Div(text = div_img_html)

however when running the server I get:

404 GET /static/tree.png (::1) 2.00ms

So basically the bokeh server doesn’t know how to retrieve the file…

Thank you in advance for any suggestions !

···

On Wednesday, July 13, 2016 at 7:58:02 PM UTC+3, Bryan Van de ven wrote:

You’ll need to:

  • make a “directory” style app

  • make a “static” subdirectoy in the app directory

  • put all your pngs, etc in the “static” subdirectoy

  • then anything in the static directory is available at the relative URL “myappname/static” (substitute whatever your actual app name is for “myappname”)

Just to be clear, it’s never going to be possible to load files from arbitrary filesystem locations like “C:/foo/bar.png”, only from the application-specific “static” directory.

Bryan

On Jul 13, 2016, at 11:48 AM, Rakesh Partapsing [email protected] wrote:

Dear Bryan,

Upon this subject you mentioned:

“The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.”

I am still not able to load any .pngs from file using bokeh 0.12 when creating an app. Again same error in JSConsoleLog which is:
localhost/:1 Not allowed to load local resource: file:///C:/foo/bar.png

My code:

fSave = r"file:///C:\foo\bar.png"

src = ColumnDataSource(dict(url = [fSave]))

plot = Figure(plot_width=800, plot_height=400)

plot.x_range=Range1d(start=0, end=1)

plot.y_range=Range1d(start=0, end=1)

plot.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=src)

Can you guide to the correct way to load png’s from file into a bokeh app?

Greetings,

Rakesh

On Thu, Jun 23, 2016 at 11:38 PM, Bryan Van de Ven [email protected] wrote:

Ok, the first problem is that you don’t put “file://” in the URL. Without this, the browser tries to load from a relative URL on the bokeh server, and this fails with a 404. However, even putting in that, then I see a different error in the JS console:

    Not allowed to load local resource: file:///private/tmp/logo.png

The browser security policy is not something we have control over. The 0.12 release out in a few days has support for a per-app “static” directory, with this feature you can have the bokeh server serve your .png and then it will work.

Bryan

On Jun 23, 2016, at 4:33 PM, Bryan Van de Ven [email protected] wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

I am not sure how I gave you the impression it was not on 1 machine. Sorry for that.

You didn’t give me that impression, but neither did I want to assume that.

All is on one machine inside the same folder.

“C:\Users\Rakesh\Desktop\app\logo.png”. pathname for the logo.

Does it work on you side?

So you are suggesting to make this png an http url?

So basically loading from file is not possible?

I’m not saying that either, but I am asking if you can try to provide more information. Are there errors in the browser’s JS console? Are there any 404’s reported?

Bryan

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven [email protected] wrote:

In general, unless everything and all use is always only ever going to be on one machine, then you will probably want real http URLs.

Bryan

On Jun 23, 2016, at 4:22 PM, Bryan Van de Ven [email protected] wrote:

Rakesh,

But where is the browser? If the server is on one machine and the browser is on another, this cannot work. Or if there is a permissions issue. The URL has to be accessible to the browser. If you can’t type “file://some/path/logo.png” in the browser URL bar and see the image show up, then it won’t work in a bokeh server app either, because all ImageURL does is try to load the URL the same way. Is there any output in the browser JS console?

Bryan

On Jun 23, 2016, at 4:18 PM, Rakesh Partapsing [email protected] wrote:

Hi Bryan,

See below. Using Python 3.5, still no image. logo.png and main.py are in the same folder called ‘app’. command: bokeh serve --show app.


from os.path import dirname, join

from bokeh.models.glyphs import ImageURL

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid, VBox

from bokeh.io import curdoc

from bokeh.models.widgets import Panel, Tabs, Paragraph

url = join(dirname(file), ‘logo.png’)

source = ColumnDataSource(dict(url = [url]))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(title=“ImageURL”, x_range=xdr, y_range=ydr)

image1 = ImageURL(url=“url”, x=0, y=1, w=1, h=1, anchor=“center”, global_alpha=0.2)

plot.add_glyph(source, image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

p1 = VBox(Paragraph(width=50), plot, width=800, height=600)

tab1 = Panel(child=p1, title=‘tab1’)

tabs = Tabs(tabs=[tab1])

curdoc().add_root(tabs)

On Thu, Jun 23, 2016 at 6:26 PM, Bryan Van de Ven [email protected] wrote:

Well, the Image code below is definitely not going to work. Can you share what you tried with ImageURL? My first thought is that the URL is simply not accessible. It’s a local file, are you viewing it on a remote machine. The URL has to be accessible to the browser. Are there any messages in the browser JS console?

Bryan

On Jun 23, 2016, at 11:19 AM, Rakesh Partapsing [email protected] wrote:

Hi,

Thank you for the quick reply.

ImageURL I also tried inside the bokeh app.

No luck sofar.

I also tried it inside the notebook using output_notebook() instead of pushing it to an html file, and again no image is displayed.

Best wishes,

Rakesh

On 23 jun. 2016, at 17:52, Bryan Van de Ven [email protected] wrote:

Hi,

Image does not accept urls or image formats. It takes 2d arrays of numbers and a colormap to color the data according to. If you want to display urls of .png, etc, you want ImageURL. See, e.g.

https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing [email protected] wrote:

I also tried the code from the example but no luck so far…

import numpy as np

from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid

from bokeh.models.glyphs import Image

from bokeh.plotting import show

from bokeh.io import show, output_notebook

url = r"C:\foo.png"

output_notebook()

source = ColumnDataSource(dict(

url = [url]

))

xdr = Range1d(start=0, end=1)

ydr = Range1d(start=0, end=1)

plot = Plot(

title=None, x_range=xdr, y_range=ydr, plot_width=300, plot_height=300,

h_symmetry=False, v_symmetry=False, min_border=0, toolbar_location=None)

image1 = Image(image=url)

plot.add_glyph(image1)

xaxis = LinearAxis()

plot.add_layout(xaxis, ‘below’)

yaxis = LinearAxis()

plot.add_layout(yaxis,‘left’)

plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))

plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

show(plot)

On Thu, Jun 23, 2016 at 5:13 PM, Raki [email protected] wrote:

Hi,

I wish to plot an image from url. The following code works fine inside a notebook.

from bokeh.plotting import Figure, show, output_file

from bokeh.models import ColumnDataSource

output_file(‘image.html’)

url = r’C:\foo.png’

source = ColumnDataSource(dict(url = [url]))

p = Figure(x_range=(0,1), y_range=(0,1), plot_width=800, plot_height=400)

p.image_url(url=‘url’, x=0, y=1, h=1, w=1, source=source)

show(p)

…but fails to run inside a bokeh app: first some errors on the x,y-ranges and also the image is not loaded + gives no error.

Any help here is much appreciated.

Best wishes,

Rakesh

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/866781e4-3d23-41a3-9a9e-9720b555bb76%40continuum.io.

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

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/CAKGpf60t%3DqKcRsF834%3DS5WNe0-VS__xdUeqb1mrUpmmqSPWRGg%40mail.gmail.com.

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

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/5C34A16E-87FC-4D80-906E-C8EBE02D1426%40continuum.io.

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

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/C357537C-FC04-4F0F-BC7B-74CF6DB22E91%40gmail.com.

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

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/EF114BCB-C227-44E2-94BC-A62C09DEF7A4%40continuum.io.

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

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/CAKGpf61rxLeWEwhmkM-fcHXx%2BZzWoYWPTNUv%2BitkFikYp51R4g%40mail.gmail.com.

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

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/221EF78A-8DD9-406D-AB05-0AD435109B10%40continuum.io.

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

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/CAKGpf60r9A%3DA6yk0eQ6XYc35odvfZEiQ3TS%3DQtEEXXjCmvuv3g%40mail.gmail.com.

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

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/6EF0C055-4D5E-41F2-88D1-4722D33F1EC5%40continuum.io.

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


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/CAKGpf63uTASm0%2B2FVzSrrJqR7uEmv06rfMaPST4MmzqUJJ%3DDRA%40mail.gmail.com.

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