☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

How to load image in Bokeh App

Community Support
Rakesh_Partapsing
Rakesh_Partapsing

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

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryanv@continuum.io 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
>>> To post to this group, send email to bokeh@continuum.io.
>>> 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 bokeh+unsubscribe@continuum.io.
>>> To post to this group, send email to bokeh@continuum.io.
>>> 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 bokeh+unsubscribe@continuum.io.
>> To post to this group, send email to bokeh@continuum.io.
>> 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 bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Bryan
Bryan

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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> wrote:

On Thu, Jun 23, 2016 at 11:23 PM, Bryan Van de Ven <bryan@bokeh.org> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>> To post to this group, send email to bokeh@continuum.io.
>>>> 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 bokeh+unsubscribe@continuum.io.
>>> To post to this group, send email to bokeh@continuum.io.
>>> 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 bokeh+unsubscribe@continuum.io.
>> To post to this group, send email to bokeh@continuum.io.
>> 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 bokeh+unsubscribe@continuum.io.
>> To post to this group, send email to bokeh@continuum.io.
>> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryan@bokeh.org wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <bryan@bokeh.org> wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> wrote:

> On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryanv@continuum.io> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
> >>>>> To post to this group, send email to bokeh@continuum.io.
> >>>>> 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 bokeh+unsubscribe@continuum.io.
> >>>>> To post to this group, send email to bokeh@continuum.io.
> >>>>> 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 bokeh+unsubscribe@continuum.io.
> >>>> To post to this group, send email to bokeh@continuum.io.
> >>>> 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 bokeh+unsubscribe@continuum.io.
> >>> To post to this group, send email to bokeh@continuum.io.
> >>> 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 bokeh+unsubscribe@continuum.io.
> >> To post to this group, send email to bokeh@continuum.io.
> >> 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 bokeh+unsubscribe@continuum.io.
> >> To post to this group, send email to bokeh@continuum.io.
> >> 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 bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryanv@continuum.io 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 r.partapsing@gmail.com 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 bryan@bokeh.org wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryanv@continuum.io 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 r.partapsing@gmail.com 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 bryan@bokeh.org wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> wrote:
>
> > On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <r.partapsing@gmail.com> 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 <bryanv@continuum.io> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryanv@continuum.io> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
> > >>>>> To post to this group, send email to bokeh@continuum.io.
> > >>>>> 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 bokeh+unsubscribe@continuum.io.
> > >>>>> To post to this group, send email to bokeh@continuum.io.
> > >>>>> 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 bokeh+unsubscribe@continuum.io.
> > >>>> To post to this group, send email to bokeh@continuum.io.
> > >>>> 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 bokeh+unsubscribe@continuum.io.
> > >>> To post to this group, send email to bokeh@continuum.io.
> > >>> 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 bokeh+unsubscribe@continuum.io.
> > >> To post to this group, send email to bokeh@continuum.io.
> > >> 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 bokeh+unsubscribe@continuum.io.
> > >> To post to this group, send email to bokeh@continuum.io.
> > >> 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 bokeh+unsubscribe@continuum.io.
> > To post to this group, send email to bokeh@continuum.io.
> > 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 bokeh+unsubscribe@continuum.io.
> > To post to this group, send email to bokeh@continuum.io.
> > 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 bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

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 bryan@bokeh.org 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 bryan@bokeh.org wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <bryan@bokeh.org> wrote:
>
>
>> On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <r.partapsing@gmail.com> 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 <bryanv@continuum.io> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <bryanv@continuum.io> 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 <r.partapsing@gmail.com> 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 <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
>>>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>>> To post to this group, send email to bokeh@continuum.io.
>>>>> 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 bokeh+unsubscribe@continuum.io.
>>>> To post to this group, send email to bokeh@continuum.io.
>>>> 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 bokeh+unsubscribe@continuum.io.
>>>> To post to this group, send email to bokeh@continuum.io.
>>>> 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 bokeh+unsubscribe@continuum.io.
>> To post to this group, send email to bokeh@continuum.io.
>> 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 bokeh+unsubscribe@continuum.io.
>> To post to this group, send email to bokeh@continuum.io.
>> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
Rakesh_Partapsing
Rakesh_Partapsing

Thank you, works like a charm!

···

On Wed, Jul 13, 2016 at 6:57 PM, Bryan Van de Ven bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.partapsing@gmail.com 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 bryan@bokeh.org 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 bryan@bokeh.org 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 r.partapsing@gmail.com 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 r.partapsing@gmail.com 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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

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.

⌁   Link to post
Andrei_Ionut_Damian
Andrei_Ionut_Damian

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 r.part...@gmail.com 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 bry...@continuum.io 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 bry...@continuum.io wrote:

On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing r.part...@gmail.com 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 bry...@continuum.io 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 bry...@continuum.io 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 r.part...@gmail.com 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 bry...@continuum.io 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 r.part...@gmail.com 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 bry...@continuum.io 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 r.part...@gmail.com 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 r.part...@gmail.com 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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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.

⌁   Link to post
Bryan
Bryan

Hi, every app has it's own static path, e.g. if I add a static dir to the weather app, and run

  bokeh serve weather

Then a file foo.txt I put in static is at:

  http://localhost:5006/static/foo.txt

So perhaps you need to add the app name to the path?

Bryan

···

On Jan 10, 2017, at 4:21 AM, ionutdam@gmail.com wrote:

Hello,
I have the same issue however I can not find a way to solve it...
Basically mycode looks like this:

  div_img_html = "<img src='static/image.png'>"
  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 <r.part...@gmail.com> 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 <bry...@continuum.io> 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 <bry...@continuum.io> wrote:
> >
> >
> >> On Jun 23, 2016, at 4:31 PM, Rakesh Partapsing <r.part...@gmail.com> 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 <bry...@continuum.io> 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 <bry...@continuum.io> 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 <r.part...@gmail.com> 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 <bry...@continuum.io> 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 <r.part...@gmail.com> 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 <bry...@continuum.io> 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 <r.part...@gmail.com> 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 <r.part...@gmail.com> 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 bokeh+un...@continuum.io.
> >>>>>>> To post to this group, send email to bo...@continuum.io.
> >>>>>>> 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 bokeh+un...@continuum.io.
> >>>>>>> To post to this group, send email to bo...@continuum.io.
> >>>>>>> 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 bokeh+un...@continuum.io.
> >>>>>> To post to this group, send email to bo...@continuum.io.
> >>>>>> 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 bokeh+un...@continuum.io.
> >>>>> To post to this group, send email to bo...@continuum.io.
> >>>>> 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 bokeh+un...@continuum.io.
> >>>> To post to this group, send email to bo...@continuum.io.
> >>>> 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 bokeh+un...@continuum.io.
> >>>> To post to this group, send email to bo...@continuum.io.
> >>>> 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 bokeh+un...@continuum.io.
> >> To post to this group, send email to bo...@continuum.io.
> >> 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 bokeh+un...@continuum.io.
> >> To post to this group, send email to bo...@continuum.io.
> >> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> 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 bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/909d65d8-e9ad-44c3-9b6e-404297e9fbb1%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
drcdrgm
drcdrgm

Hello,

I am also having problems showing local images, though images from the web are displayed fine.

My directory structure and files are:

Ex1/

Ex1/ShowImage.py

Ex1/static/tree.png

Below is ShowImage.py. I run it as: bokeh serve --show ShowImage.py

What am I doing wrong?

Thanks,

Chris

···

‘’’ ShowImage.py: show image on figure in Bokeh. ‘’’

from os.path import dirname, join

from bokeh.io import curdoc

from bokeh.models import ColumnDataSource

from bokeh.plotting import figure

def PerformPlot():

url1 = “http://bokeh.pydata.org/en/latest/_static/images/logo.png” # WORKS

None of the following work…

#url1 = “http://localhost:5006/static/tree.png” # 404 error

#url1 = “http://localhost:5006/tree.png” # 404 error

#url1 = join(dirname(file), ‘static/tree.png’) # no error, but nothing shown

#url1 = “static/tree.png” # 404 error

#url1 = “tree.png” # 404 error

print(“URL IS: %s” % url1)

Add an additional image plot

plot2 = figure(plot_height=400, plot_width=400, title=“Image”, x_range=(0, 1), y_range=(0, 1))

cds = ColumnDataSource(dict(url=[url1]))

plot2.image_url(url=‘url’, x=0.5, y=0.5, w=1, h=1, anchor=“center”, source=cds)

this works too:

plot2.image_url(url=[url1], x=0.5, y=0.5, w=1, h=1, anchor=“center”)

curdoc().add_root(plot2)

PerformPlot()

On Thursday, June 23, 2016 at 11:13:23 AM UTC-4, Raki 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

⌁   Link to post
Bryan
Bryan

Here is a minimal bokeh server app example:

  # main.py
  from bokeh.io import curdoc
  from bokeh.plotting import figure

  p = figure(x_range=(0,10), y_range=(0,10))
  p.image_url(x=5, y=5, w=2, h=2, url=["imgtest/static/logo.png"])

  curdoc().add_root℗

This assumes the following directory structure, as described earlier:

  imgtest/
     + main.py
     + static/
    + logo.png

Then run (in the directory above "imgtest") with

  bokeh serve --show imgtest

Thanks,

Bryan

···

On Jun 23, 2016, at 10:52, Bryan Van de ven <bryan@bokeh.org> 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 <r.partapsing@gmail.com> 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 <r.partapsing@gmail.com> 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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
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\.

⌁   Link to post
jameswaltner
jameswaltner

all of these examples use bokeh.plotting.figure to include images. (I appologize in advance if the following is really a separate topic)

Is it possible to access the static directory inside a div for the purposes of displaying a header or footer images? Or am I missing something that would allow you to include a bokeh app layout inside a wrapper HTML file to give you nice headers and footers?

I did the following and then included the div_footer object in the layout and the tags came through, but showed up as broken references. Note that I placed the images inside the static folder and I launch the serve app with

bokeh serve main.py --show

···

from bokeh.models.widgets import Div

footer_text = “”"

.footer { height: 30px; width: 100%; } img { max-width: 100%; max-height: 100%; }

[External image unavailable in archive]

[External image unavailable in archive]

“”"

div_footer = Div(text=footer_text,width=1000,height=30)


Please advise. Thanks!

-james

On Saturday, November 25, 2017 at 12:51:34 PM UTC-5, Bryan Van de ven wrote:

Here is a minimal bokeh server app example:

    # main.py
    from [bokeh.io](http://bokeh.io) import curdoc
    from bokeh.plotting import figure


    p = figure(x_range=(0,10), y_range=(0,10))
    p.image_url(x=5, y=5, w=2, h=2, url=["imgtest/static/logo.png"])


    curdoc().add_root℗

This assumes the following directory structure, as described earlier:

    imgtest/

       + main.py

       + static/

            + logo.png

Then run (in the directory above “imgtest”) with

    bokeh serve --show imgtest

Thanks,

Bryan

On Jun 23, 2016, at 10:52, Bryan Van de ven bry...@continuum.io 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](https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py)

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing r.part...@gmail.com 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 r.part...@gmail.com 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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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.

⌁   Link to post
jameswaltner
jameswaltner

I apologize in advance if this is a double post, I hit “Reply”, but didn’t see the reply get posted… I also apologize if this should be a separate post, but it appears to fit here.

I would like to add images to the bokeh app to make it look nice. In particular, would like to add headers and footers. I tried the following to create a div element, and while the div element gets created, all of the img elements show up as broken. Note that I have placed the required images in static directory as discussed above and launched the bokeh server from the directory above my project as shown above.

Is what I am trying to do possible?

Is there a better way of wrapping the bokeh app to give it nice headers and footers or include it in another page?

···

from bokeh.models.widgets import Div

footer_text = “”"

.footer { height: 30px; width: 100%; } img { max-width: 100%; max-height: 100%; }

[External image unavailable in archive]

[External image unavailable in archive]

“”"

div_footer = Div(text=footer_text,width=1000,height=30)

note that in my implementation, there are more elements in the column, but this is not needed for this example.

col = column(div_footer)

create the document

curdoc().add_root(col)

curdoc().title = “My Bokeh App with Footers”


On Saturday, November 25, 2017 at 12:51:34 PM UTC-5, Bryan Van de ven wrote:

Here is a minimal bokeh server app example:

    # main.py
    from [bokeh.io](http://bokeh.io) import curdoc
    from bokeh.plotting import figure


    p = figure(x_range=(0,10), y_range=(0,10))
    p.image_url(x=5, y=5, w=2, h=2, url=["imgtest/static/logo.png"])


    curdoc().add_root℗

This assumes the following directory structure, as described earlier:

    imgtest/

       + main.py

       + static/

            + logo.png

Then run (in the directory above “imgtest”) with

    bokeh serve --show imgtest

Thanks,

Bryan

On Jun 23, 2016, at 10:52, Bryan Van de ven bry...@continuum.io 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](https://github.com/bokeh/bokeh/blob/master/examples/models/image_url.py)

Thanks,

Bryan

On Jun 23, 2016, at 10:44 AM, Rakesh Partapsing r.part...@gmail.com 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 r.part...@gmail.com 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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

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.

⌁   Link to post
jameswaltner
jameswaltner

got it working… from the example above, needed to start it as Bryan suggested in the directory above the project and the path needs to be the folder name of the project, in this case ‘imgtest’. My previous version used “main” instead of “imgtest” and hence it didn’t work.

Some code here for making an HTML footer with an image inside.

···

from bokeh.models.widgets import Div

footer_text = “”"

.footer { height: 30px; width: 100%; } img { max-width: 100%; max-height: 100%; }

[External image unavailable in archive]

“”"

div_footer = Div(text=footer_text,width=1000,height=30)

note that in my implementation, there are more elements in the column, but this is not needed for this example.

col = column(div_footer)

create the document

curdoc().add_root(col)

curdoc().title = “My Bokeh App with Footers”

⌁   Link to post

End of archived discussion · Replies are disabled