Updating data slow

I have an infrared thermometer (8x8 pixels) that I’m plotting. I’m trying to refresh the data and plot again. It’s working, but it’s super slow - about 5 minutes for the plot to refresh.

The refreshing is done in the function on_button_clicked(b). I’m recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?

Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User's guide documentation data sources in Bokeh:

  https://bokeh.pydata.org/en/latest/docs/user_guide/data.html

Bryan

···

On Oct 2, 2017, at 09:02, Diego Aguilera <[email protected]> wrote:

I have an infrared thermometer (8x8 pixels) that I'm plotting. I'm trying to refresh the data and plot again. It's working, but it's super slow - about 5 minutes for the plot to refresh.

The refreshing is done in the function on_button_clicked(b). I'm recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?

https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb

--
You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Wow. That is a whole lot quicker… I think. It’s drawing the squares, but only in white.

def createPlot(_plt, _dataColor, _dataDecimal):

print data[‘dataColor’]

_plt.square(x=‘x_values’, y=‘y_values’, color=‘dataColor’, fill_alpha=1.0, source=source, size=64, line_color=‘black’, line_alpha=1)

‘dataColor’

['#2f00ff', '#7a00ff', '#5400ff', '#2f00ff', '#5400ff', '#0900ff', '#0042ff', '#00b3ff', '#7a00ff', '#a000ff', '#a000ff', '#5400ff', '#0067ff', '#0067ff', '#0042ff', '#00d9ff', '#0900ff', '#ec00ff', '#a000ff', '#2f00ff', '#0067ff', '#0042ff', '#0042ff', '#00ffff', '#7a00ff', '#a000ff', '#ff00ec', '#7a00ff', '#001cff', '#5400ff', '#ff0055', '#00d9ff', '#7a00ff', '#7a00ff', '#ff0055', '#c600ff', '#0900ff', '#a000ff', '#ff007a', '#0067ff', '#c600ff', '#ff00ec', '#ff002f', '#ffb300', '#ffff00', '#ff0009', '#ff002f', '#a000ff', '#7a00ff', '#c600ff', '#ff1c00', '#ff6700', '#ff4200', '#ff6700', '#ffff00', '#ff8d00', '#00b3ff', '#0042ff', '#ff00a0', '#ff4200', '#ff002f', '#c600ff', '#a000ff', '#0042ff']

So there’s hex data there. But again, the plot only comes out with white squares!?

···

On Monday, October 2, 2017 at 10:08:46 AM UTC-4, Bryan Van de ven wrote:

Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User’s guide documentation data sources in Bokeh:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/data.html](https://bokeh.pydata.org/en/latest/docs/user_guide/data.html)

Bryan

On Oct 2, 2017, at 09:02, Diego Aguilera [email protected] wrote:

I have an infrared thermometer (8x8 pixels) that I’m plotting. I’m trying to refresh the data and plot again. It’s working, but it’s super slow - about 5 minutes for the plot to refresh.

The refreshing is done in the function on_button_clicked(b). I’m recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?

https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb


You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%40continuum.io.

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

Hi,

I'm not sure where the usage error might be without seeing and running full code. So instead, here is a minimal working app example similar to yours that will hopefully be useful in comparison:

    from bokeh.io import curdoc
    from bokeh.models import ColumnDataSource
    from bokeh.palettes import Spectral6 # list of hex color strings
    from bokeh.plotting import figure

    source = ColumnDataSource(data=dict(
        x=[1,2,3,4,5,6],
        y=[2,2,2,2,2,2],
        c=Spectral6
    ))

    p = figure()
    p.square(x='x', y='y', color='c', size=30, source=source)

    curdoc().add_root(p)

    def update():
        # rotate the colors
        source.data['c'] = source.data['c'][1:] + [source.data['c'][0]]

    curdoc().add_periodic_callback(update, 200)

And here is a link to an example notebook for embedding a real Bokeh apps in a notebooks, which I personally consider better than using push_notebook:

  https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb

Thanks,

Bryan

···

On Oct 2, 2017, at 11:13, Diego Aguilera <[email protected]> wrote:

Wow. That is a whole lot quicker... I think. It's drawing the squares, but only in white.

def createPlot(_plt, _dataColor, _dataDecimal):

    print data['dataColor']
    _plt.square(x='x_values', y='y_values', color='dataColor', fill_alpha=1.0, source=source, size=64, line_color='black', line_alpha=1)
    
'dataColor'
['#2f00ff', '#7a00ff', '#5400ff', '#2f00ff', '#5400ff', '#0900ff', '#0042ff', '#00b3ff', '#7a00ff', '#a000ff', '#a000ff', '#5400ff', '#0067ff', '#0067ff', '#0042ff', '#00d9ff', '#0900ff', '#ec00ff', '#a000ff', '#2f00ff', '#0067ff', '#0042ff', '#0042ff', '#00ffff', '#7a00ff', '#a000ff', '#ff00ec', '#7a00ff', '#001cff', '#5400ff', '#ff0055', '#00d9ff', '#7a00ff', '#7a00ff', '#ff0055', '#c600ff', '#0900ff', '#a000ff', '#ff007a', '#0067ff', '#c600ff', '#ff00ec', '#ff002f', '#ffb300', '#ffff00', '#ff0009', '#ff002f', '#a000ff', '#7a00ff', '#c600ff', '#ff1c00', '#ff6700', '#ff4200', '#ff6700', '#ffff00', '#ff8d00', '#00b3ff', '#0042ff', '#ff00a0', '#ff4200', '#ff002f', '#c600ff', '#a000ff', '#0042ff']

So there's hex data there. But again, the plot only comes out with white squares!?

On Monday, October 2, 2017 at 10:08:46 AM UTC-4, Bryan Van de ven wrote:
Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User's guide documentation data sources in Bokeh:

        https://bokeh.pydata.org/en/latest/docs/user_guide/data.html

Bryan

> On Oct 2, 2017, at 09:02, Diego Aguilera <[email protected]> wrote:
>
> I have an infrared thermometer (8x8 pixels) that I'm plotting. I'm trying to refresh the data and plot again. It's working, but it's super slow - about 5 minutes for the plot to refresh.
>
>
> The refreshing is done in the function on_button_clicked(b). I'm recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?
>
> https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb
>
>
> --
> You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%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/83ca3e31-f252-4354-bf00-b0fa0155b8f1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan.

I’ve updated the code.

I’ve never used curdoc before. I don’t have a bokeh server. I’m just running a Jupyter notebook. I don’t know if that matters for curdoc.

The plot displays properly if I update data source as following:

#Get init data
dataColor, dataDecimal = refreshSensor()

#Update Datasource
data[‘dataColor’] = dataColor
data[‘dataDecimal’] = dataDecimal
source = ColumnDataSource(data=data)

pltA = figure(responsive=True, width=800, height=300, toolbar_location=“above”, tools=‘tap, box_zoom, pan, undo, crosshair, hover, reset, wheel_zoom, save’)
createPlot(pltA, dataColor, dataDecimal)

#Show init plot
handleT = show(pltA, notebook_handle=True)

When I update the sensor data, I again call source=ColumnDataSource(data=data). But I never see the plot update.

···

On Monday, October 2, 2017 at 12:35:35 PM UTC-4, Bryan Van de ven wrote:

Hi,

I’m not sure where the usage error might be without seeing and running full code. So instead, here is a minimal working app example similar to yours that will hopefully be useful in comparison:

from [bokeh.io](http://bokeh.io) import curdoc

from bokeh.models import ColumnDataSource

from bokeh.palettes import Spectral6 # list of hex color strings

from bokeh.plotting import figure



source = ColumnDataSource(data=dict(

    x=[1,2,3,4,5,6],

    y=[2,2,2,2,2,2],

    c=Spectral6

))



p = figure()

p.square(x='x', y='y', color='c', size=30, source=source)



curdoc().add_root(p)



def update():

    # rotate the colors

    source.data['c'] = source.data['c'][1:] + [source.data['c'][0]]



curdoc().add_periodic_callback(update, 200)

And here is a link to an example notebook for embedding a real Bokeh apps in a notebooks, which I personally consider better than using push_notebook:

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb)

Thanks,

Bryan

On Oct 2, 2017, at 11:13, Diego Aguilera [email protected] wrote:

Wow. That is a whole lot quicker… I think. It’s drawing the squares, but only in white.

def createPlot(_plt, _dataColor, _dataDecimal):

print data['dataColor']
_plt.square(x='x_values', y='y_values', color='dataColor', fill_alpha=1.0, source=source, size=64, line_color='black', line_alpha=1)

‘dataColor’

[’#2f00ff’, ‘#7a00ff’, ‘#5400ff’, ‘#2f00ff’, ‘#5400ff’, ‘#0900ff’, ‘#0042ff’, ‘#00b3ff’, ‘#7a00ff’, ‘#a000ff’, ‘#a000ff’, ‘#5400ff’, ‘#0067ff’, ‘#0067ff’, ‘#0042ff’, ‘#00d9ff’, ‘#0900ff’, ‘#ec00ff’, ‘#a000ff’, ‘#2f00ff’, ‘#0067ff’, ‘#0042ff’, ‘#0042ff’, ‘#00ffff’, ‘#7a00ff’, ‘#a000ff’, ‘#ff00ec’, ‘#7a00ff’, ‘#001cff’, ‘#5400ff’, ‘#ff0055’, ‘#00d9ff’, ‘#7a00ff’, ‘#7a00ff’, ‘#ff0055’, ‘#c600ff’, ‘#0900ff’, ‘#a000ff’, ‘#ff007a’, ‘#0067ff’, ‘#c600ff’, ‘#ff00ec’, ‘#ff002f’, ‘#ffb300’, ‘#ffff00’, ‘#ff0009’, ‘#ff002f’, ‘#a000ff’, ‘#7a00ff’, ‘#c600ff’, ‘#ff1c00’, ‘#ff6700’, ‘#ff4200’, ‘#ff6700’, ‘#ffff00’, ‘#ff8d00’, ‘#00b3ff’, ‘#0042ff’, ‘#ff00a0’, ‘#ff4200’, ‘#ff002f’, ‘#c600ff’, ‘#a000ff’, ‘#0042ff’]

So there’s hex data there. But again, the plot only comes out with white squares!?

On Monday, October 2, 2017 at 10:08:46 AM UTC-4, Bryan Van de ven wrote:

Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User’s guide documentation data sources in Bokeh:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/data.html](https://bokeh.pydata.org/en/latest/docs/user_guide/data.html)

Bryan

On Oct 2, 2017, at 09:02, Diego Aguilera [email protected] wrote:

I have an infrared thermometer (8x8 pixels) that I’m plotting. I’m trying to refresh the data and plot again. It’s working, but it’s super slow - about 5 minutes for the plot to refresh.

The refreshing is done in the function on_button_clicked(b). I’m recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?

https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb


You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%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/83ca3e31-f252-4354-bf00-b0fa0155b8f1%40continuum.io.

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

Hi,

Bokeh server is part of Bokeh. If you have Bokeh installed you have the Bokeh server installed. Bokeh server applications are embeddable in Jupyter notebooks, as demonstrated in the link I provided. I would again suggest that a real Bokeh server app will always be more robust than a push_notebook solution. The notebook I linked is very short and explanatory. My suggestion is to run it and see if you might reframe what you want using a real Bokeh server app in the notebook.

Bryan

···

On Oct 2, 2017, at 12:22, Diego Aguilera <[email protected]> wrote:

Thanks Bryan.

I've updated the code.
https://github.com/aguileraGit/jupyterShare/blob/master/test2%20(1).ipynb

I've never used curdoc before. I don't have a bokeh server. I'm just running a Jupyter notebook. I don't know if that matters for curdoc.

The plot displays properly if I update data source as following:

#Get init data
dataColor, dataDecimal = refreshSensor()

#Update Datasource
data['dataColor'] = dataColor
data['dataDecimal'] = dataDecimal
source = ColumnDataSource(data=data)

pltA = figure(responsive=True, width=800, height=300, toolbar_location="above", tools='tap, box_zoom, pan, undo, crosshair, hover, reset, wheel_zoom, save')
createPlot(pltA, dataColor, dataDecimal)

#Show init plot
handleT = show(pltA, notebook_handle=True)

When I update the sensor data, I again call source=ColumnDataSource(data=data). But I never see the plot update.

On Monday, October 2, 2017 at 12:35:35 PM UTC-4, Bryan Van de ven wrote:
Hi,

I'm not sure where the usage error might be without seeing and running full code. So instead, here is a minimal working app example similar to yours that will hopefully be useful in comparison:

    from bokeh.io import curdoc
    from bokeh.models import ColumnDataSource
    from bokeh.palettes import Spectral6 # list of hex color strings
    from bokeh.plotting import figure

    source = ColumnDataSource(data=dict(
        x=[1,2,3,4,5,6],
        y=[2,2,2,2,2,2],
        c=Spectral6
    ))

    p = figure()
    p.square(x='x', y='y', color='c', size=30, source=source)

    curdoc().add_root(p)

    def update():
        # rotate the colors
        source.data['c'] = source.data['c'][1:] + [source.data['c'][0]]

    curdoc().add_periodic_callback(update, 200)

And here is a link to an example notebook for embedding a real Bokeh apps in a notebooks, which I personally consider better than using push_notebook:

        https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb

Thanks,

Bryan

> On Oct 2, 2017, at 11:13, Diego Aguilera <[email protected]> wrote:
>
> Wow. That is a whole lot quicker... I think. It's drawing the squares, but only in white.
>
> def createPlot(_plt, _dataColor, _dataDecimal):
>
> print data['dataColor']
> _plt.square(x='x_values', y='y_values', color='dataColor', fill_alpha=1.0, source=source, size=64, line_color='black', line_alpha=1)
>
>
> 'dataColor'
> ['#2f00ff', '#7a00ff', '#5400ff', '#2f00ff', '#5400ff', '#0900ff', '#0042ff', '#00b3ff', '#7a00ff', '#a000ff', '#a000ff', '#5400ff', '#0067ff', '#0067ff', '#0042ff', '#00d9ff', '#0900ff', '#ec00ff', '#a000ff', '#2f00ff', '#0067ff', '#0042ff', '#0042ff', '#00ffff', '#7a00ff', '#a000ff', '#ff00ec', '#7a00ff', '#001cff', '#5400ff', '#ff0055', '#00d9ff', '#7a00ff', '#7a00ff', '#ff0055', '#c600ff', '#0900ff', '#a000ff', '#ff007a', '#0067ff', '#c600ff', '#ff00ec', '#ff002f', '#ffb300', '#ffff00', '#ff0009', '#ff002f', '#a000ff', '#7a00ff', '#c600ff', '#ff1c00', '#ff6700', '#ff4200', '#ff6700', '#ffff00', '#ff8d00', '#00b3ff', '#0042ff', '#ff00a0', '#ff4200', '#ff002f', '#c600ff', '#a000ff', '#0042ff']
>
> So there's hex data there. But again, the plot only comes out with white squares!?
>
> On Monday, October 2, 2017 at 10:08:46 AM UTC-4, Bryan Van de ven wrote:
> Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User's guide documentation data sources in Bokeh:
>
> https://bokeh.pydata.org/en/latest/docs/user_guide/data.html
>
> Bryan
>
>
> > On Oct 2, 2017, at 09:02, Diego Aguilera <[email protected]> wrote:
> >
> > I have an infrared thermometer (8x8 pixels) that I'm plotting. I'm trying to refresh the data and plot again. It's working, but it's super slow - about 5 minutes for the plot to refresh.
> >
> >
> > The refreshing is done in the function on_button_clicked(b). I'm recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?
> >
> > https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb
> >
> >
> > --
> > You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%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/83ca3e31-f252-4354-bf00-b0fa0155b8f1%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/a94dbc82-fab3-4f0a-b6bf-4c3a09f436e9%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Otherwise, it you must use push_notebook, there are examples (including with setting and changing colors) that you can study here:
  
    https://github.com/bokeh/bokeh/tree/master/examples/howto/notebook_comms

Bryan

···

On Oct 2, 2017, at 12:27, Bryan Van de ven <[email protected]> wrote:

Hi,

Bokeh server is part of Bokeh. If you have Bokeh installed you have the Bokeh server installed. Bokeh server applications are embeddable in Jupyter notebooks, as demonstrated in the link I provided. I would again suggest that a real Bokeh server app will always be more robust than a push_notebook solution. The notebook I linked is very short and explanatory. My suggestion is to run it and see if you might reframe what you want using a real Bokeh server app in the notebook.

Bryan

On Oct 2, 2017, at 12:22, Diego Aguilera <[email protected]> wrote:

Thanks Bryan.

I've updated the code.
https://github.com/aguileraGit/jupyterShare/blob/master/test2%20(1).ipynb

I've never used curdoc before. I don't have a bokeh server. I'm just running a Jupyter notebook. I don't know if that matters for curdoc.

The plot displays properly if I update data source as following:

#Get init data
dataColor, dataDecimal = refreshSensor()

#Update Datasource
data['dataColor'] = dataColor
data['dataDecimal'] = dataDecimal
source = ColumnDataSource(data=data)

pltA = figure(responsive=True, width=800, height=300, toolbar_location="above", tools='tap, box_zoom, pan, undo, crosshair, hover, reset, wheel_zoom, save')
createPlot(pltA, dataColor, dataDecimal)

#Show init plot
handleT = show(pltA, notebook_handle=True)

When I update the sensor data, I again call source=ColumnDataSource(data=data). But I never see the plot update.

On Monday, October 2, 2017 at 12:35:35 PM UTC-4, Bryan Van de ven wrote:
Hi,

I'm not sure where the usage error might be without seeing and running full code. So instead, here is a minimal working app example similar to yours that will hopefully be useful in comparison:

   from bokeh.io import curdoc
   from bokeh.models import ColumnDataSource
   from bokeh.palettes import Spectral6 # list of hex color strings
   from bokeh.plotting import figure

   source = ColumnDataSource(data=dict(
       x=[1,2,3,4,5,6],
       y=[2,2,2,2,2,2],
       c=Spectral6
   ))

   p = figure()
   p.square(x='x', y='y', color='c', size=30, source=source)

   curdoc().add_root(p)

   def update():
       # rotate the colors
       source.data['c'] = source.data['c'][1:] + [source.data['c'][0]]

   curdoc().add_periodic_callback(update, 200)

And here is a link to an example notebook for embedding a real Bokeh apps in a notebooks, which I personally consider better than using push_notebook:

       https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb

Thanks,

Bryan

On Oct 2, 2017, at 11:13, Diego Aguilera <[email protected]> wrote:

Wow. That is a whole lot quicker... I think. It's drawing the squares, but only in white.

def createPlot(_plt, _dataColor, _dataDecimal):

   print data['dataColor']
   _plt.square(x='x_values', y='y_values', color='dataColor', fill_alpha=1.0, source=source, size=64, line_color='black', line_alpha=1)

'dataColor'
['#2f00ff', '#7a00ff', '#5400ff', '#2f00ff', '#5400ff', '#0900ff', '#0042ff', '#00b3ff', '#7a00ff', '#a000ff', '#a000ff', '#5400ff', '#0067ff', '#0067ff', '#0042ff', '#00d9ff', '#0900ff', '#ec00ff', '#a000ff', '#2f00ff', '#0067ff', '#0042ff', '#0042ff', '#00ffff', '#7a00ff', '#a000ff', '#ff00ec', '#7a00ff', '#001cff', '#5400ff', '#ff0055', '#00d9ff', '#7a00ff', '#7a00ff', '#ff0055', '#c600ff', '#0900ff', '#a000ff', '#ff007a', '#0067ff', '#c600ff', '#ff00ec', '#ff002f', '#ffb300', '#ffff00', '#ff0009', '#ff002f', '#a000ff', '#7a00ff', '#c600ff', '#ff1c00', '#ff6700', '#ff4200', '#ff6700', '#ffff00', '#ff8d00', '#00b3ff', '#0042ff', '#ff00a0', '#ff4200', '#ff002f', '#c600ff', '#a000ff', '#0042ff']

So there's hex data there. But again, the plot only comes out with white squares!?

On Monday, October 2, 2017 at 10:08:46 AM UTC-4, Bryan Van de ven wrote:
Yes, there are many example of updating ColumnDataSources for an existing plot in the GitHub repo examples. You should be making one call to square with all the data, to draw all the squares in a vectorized fashion (or construct an RGBA image and use p.image would be another good approach), not making 64 calls to draw individual squares. You should also see the User's guide documentation data sources in Bokeh:

       https://bokeh.pydata.org/en/latest/docs/user_guide/data.html

Bryan

On Oct 2, 2017, at 09:02, Diego Aguilera <[email protected]> wrote:

I have an infrared thermometer (8x8 pixels) that I'm plotting. I'm trying to refresh the data and plot again. It's working, but it's super slow - about 5 minutes for the plot to refresh.

The refreshing is done in the function on_button_clicked(b). I'm recreating the squares with location, color, and text. Can I access the original data and update the properties without creating them again?

https://github.com/aguileraGit/jupyterShare/blob/master/test2.ipynb

--
You received this message because you are 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/ac9c3369-17c4-4967-b8b7-adb40630fd3f%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/83ca3e31-f252-4354-bf00-b0fa0155b8f1%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/a94dbc82-fab3-4f0a-b6bf-4c3a09f436e9%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.