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