Conflict while using slider and button widget

Hello!. First of all I need to say that I am rather new to python and I know nothing of javascript. I am developing a small code with python and I am running it in a bokeh server.

I have a set of data that I expand or diminish with a set of sliders, once I have the final data (not moving the sliders any more) I need to make some calculations, for this I thought I could use a button. The idea will be to select the data with the sliders, then use this ‘new_data’ to make the calculation via the button, so when I press the button the final data goes through a function a this function returns something.

The problem is that when I click the button the “new data” does not get modify and I get a message: error handling message Message ‘PATCH-DOC’ (revision 1): TypeError("‘ColumnDataSource’ object has no attribute ‘getitem’",)

I saw https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/eVX31sGGHaI but the links in there goes to ‘404’ pages. I hope someone would explain to me the error I am making, I think it must be some stupid thing but I can not realize what it is.

The (not working) code I am trying to use is:

import numpy as np
import math
from numpy import loadtxt

from bokeh.plotting import figure, output_file, show
from bokeh.layouts import layout, widgetbox,row
from bokeh.models.widgets import Slider, Button
from bokeh.models import ColumnDataSource
from bokeh.io import curdoc

from lmfit.models import GaussianModel
from aju_gauss_test1 import gauss

output_file(‘mecagoenesto’)

data=loadtxt(‘sn1996cb-19961217.dat’)
x0=data[:,0]
x1=np.array(x0).tolist()
y0=data[:,1]
escala=10**(-int(math.log(abs(y0[0]),10)))
y1=np.array(y0*escala).tolist()

def f_n(array,value):
idx=(np.abs(array-value)).argmin()
return array[idx]

lp=f_n(np.array(x1),5937.5)
rp=f_n(np.array(x1),6312.5)

x = x1[x1.index(lp):x1.index(rp)]
y = y1[x1.index(lp):x1.index(rp)]

source=ColumnDataSource(data={‘x’:x, ‘y’:y})
p=figure(title=‘prueba’,x_axis_label=‘lambda’,y_axis_label=‘flujo’)
p.line(x=‘x’,y=‘y’,source=source,color=‘blue’,legend=‘linea’)

def update_x(attr,old,new):

# Read the current value of the slider: scale
sv1 = slider1.value
sv2= slider2.value
new_x_azul=f_n(np.array(x1),sv1)
new_x_rojo=f_n(np.array(x1),sv2)
# Update source with the new data values
slider_new_data = {
    'x':x1[x1.index(new_x_azul):x1.index(new_x_rojo)],
    'y':y1[x1.index(new_x_azul):x1.index(new_x_rojo)]
}

source.data=slider_new_data

source_gauss=ColumnDataSource(data={‘x’:source.data[‘x’],‘y’:source.data[‘y’]}) #This is a data I need to use for the calculations

def update():
button_new_data={
‘x’:source_gauss[‘x’],
‘y’:source_gauss[‘y’]
}

source_gauss.data=button_new_data

#I want to pass this values to a function but they are empty or something
x_for_gauss=source_gauss.data[‘x’]
y_for_gauss=source_gauss.data[‘y’]

slider1=Slider(start=5750,end=6125,value=5937.5,step=0.1,title=‘azul’)
slider2=Slider(start=6125,end=6500,value=6312.5,step=0.1,title=‘rojo’)

slider1.on_change(‘value’,update_x)
slider2.on_change(‘value’,update_x)

button=Button(label=‘Make Adjustment’)
button.on_click(update)

inputs = widgetbox(slider1,slider2,button,sizing_mode = ‘fixed’)

l = layout([
[inputs, p],
], sizing_mode=‘fixed’)

curdoc().add_root(l)
curdoc().title = “pruebas”

``

``

The problem is here:

def update():
    button_new_data={
            'x':source_gauss['x'],
            'y':source_gauss['y']
    }

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement __getitem__ (which is the error you are seeing). Perhaps you mean

  source_gauss.data['x']

etc.

Thanks,

Bryan

Ok, first of all thank you for the fast response. So I tried this and it solved the error message, but when I move the sliders to change the data, I want the ‘button_new_data’ to change when I press the button, and that is not happening. Do you have any idea why?

···

On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:

The problem is here:

def update():

button_new_data={
        'x':source_gauss['x'],
        'y':source_gauss['y']
}

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement getitem (which is the error you are seeing). Perhaps you mean

    source_gauss.data['x']

etc.

Thanks,

Bryan

I am sorry but I am still having trouble with this, is there any way I can retrieve the last value of a set of data from a callback function? Because I found that if I print the source.data inside the callback function, it’s printed everytime I change a slider, but when I want to use the final value I can’t.
For example if the data is x=[2,3,4,5,6,7] and I plot that, and then I change the limits with a slider to see a plot of x=[4,5,6] I want to retrieve x=[4,5,6] to make some calculations with that.

I don’t know if you can tell me how it’s done but I just need to know if you know if this can be done because I tried a million things and nothing seems to work.

Thank you a lot

···

On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:

The problem is here:

def update():

button_new_data={
        'x':source_gauss['x'],
        'y':source_gauss['y']
}

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement getitem (which is the error you are seeing). Perhaps you mean

    source_gauss.data['x']

etc.

Thanks,

Bryan

Hi,

Can you please provide your complete new code to examine?

Thanks,

Bryan

···

On Apr 21, 2017, at 23:53, [email protected] wrote:

I am sorry but I am still having trouble with this, is there any way I can retrieve the last value of a set of data from a callback function? Because I found that if I print the source.data inside the callback function, it's printed everytime I change a slider, but when I want to use the final value I can't.
For example if the data is x=[2,3,4,5,6,7] and I plot that, and then I change the limits with a slider to see a plot of x=[4,5,6] I want to retrieve x=[4,5,6] to make some calculations with that.
I don't know if you can tell me how it's done but I just need to know if you know if this can be done because I tried a million things and nothing seems to work.
Thank you a lot

On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:
The problem is here:

> def update():
> button_new_data={
> 'x':source_gauss['x'],
> 'y':source_gauss['y']
> }

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement __getitem__ (which is the error you are seeing). Perhaps you mean

        source_gauss.data['x']

etc.

Thanks,

Bryan

--
You received this message because you are 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/8f22f86c-c828-4b60-80c2-2768a028891a%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Of course, I tried several ways of doing this, the last one is (I WROTE IN CAPITAL LETTERS IN THE COMMENTS WHAT IS MY PROBLEM):
import numpy as np
import math
from numpy import loadtxt

from bokeh.plotting import figure, output_file, show
from bokeh.layouts import layout, widgetbox,row
from bokeh.models.widgets import Slider, Button
from bokeh.models import ColumnDataSource
from bokeh.io import curdoc

from lmfit.models import GaussianModel
from aju_gauss_test1 import gauss

output_file(‘mecagoenesto’)

data=loadtxt(‘sn1996cb-19961217.dat’)
x0=data[:,0]
x1=np.array(x0).tolist()
y0=data[:,1]
escala=10**(-int(math.log(abs(y0[0]),10)))
y1=np.array(y0*escala).tolist()

def f_n(array,value):
idx=(np.abs(array-value)).argmin()
return array[idx]

lp=f_n(np.array(x1),5937.5)
rp=f_n(np.array(x1),6312.5)

x = x1[x1.index(lp):x1.index(rp)]
y = y1[x1.index(lp):x1.index(rp)]

source=ColumnDataSource(data={‘x’:x, ‘y’:y})
p=figure(title=‘prueba’,x_axis_label=‘lambda’,y_axis_label=‘flujo’)
p.line(x=‘x’,y=‘y’,source=source,color=‘blue’,legend=‘linea’)

def update_x(attr,old,new):

# Read the current value of the slider: scale
sv1 = slider1.value
sv2= slider2.value
new_x_azul=f_n(np.array(x1),sv1)
new_x_rojo=f_n(np.array(x1),sv2)
# Update source with the new data values
slider_new_data = {
        'x':x1[x1.index(new_x_azul):x1.index(new_x_rojo)],
        'y':y1[x1.index(new_x_azul):x1.index(new_x_rojo)]
}

source.data=slider_new_data
#I WANT TO RETRIEVE THE LAST VALUES OF SOURCE DATA, BUT IF I DEFINE:
#x_for_gauss=source.data['x']
#y_for_gauss=source.data['y']
#AND THEN TRY TO USE THEM OUTSIDE THIS FUNCTION I GET A MESSAGE THAT x_for_gauss AND y_for_gauss ARE NOT DEFINE. IF I PRINT THEM HERE THE LAST VALUES OF THE SLIDERS ARE PRINTED (THAT IS WHAT I WANT)

#SO I USE THIS, AND WORKS FOR THE ORGINAL DATA SET, BUT WHEN I PRESS THE BUTTON (I WANT TO MAKE AN ADJUSTMENT WITH THE FINAL DATA SET FROM THE SLIDERS) NOTHING HAPPENS
x_for_gauss=source.data[‘x’]
y_for_gauss=source.data[‘y’]
source_gauss=ColumnDataSource(data={‘x’:x_for_gauss,‘y’:y_for_gauss})

def update():
button_new_data={
‘x’:source_gauss.data[‘x’],
‘y’:source_gauss.data[‘y’]
}

source_gauss.data=button_new_data

slider1=Slider(start=5750,end=6125,value=5937.5,step=0.1,title=‘azul’)
slider2=Slider(start=6125,end=6500,value=6312.5,step=0.1,title=‘rojo’)

slider1.on_change(‘value’,update_x)
slider2.on_change(‘value’,update_x)

button=Button(label=‘Make Adjustment’)
button.on_click(update)

#HERE IS THE ADJUSTMENT IT IS MADE WITH THE ORIGINAL DATA SET BUT IT DOES NOT UPDATE WHEN I PRESS THE BUTTON
xg,y2,yg=gauss(source.data[‘x’],source.data[‘y’])
source2=ColumnDataSource(data={‘x’:xg, ‘y’:yg})
source3=ColumnDataSource(data={‘x’:xg, ‘y’:y2})
p.line(xg,yg,source=source2,line_color=‘red’,line_dash=‘dotdash’,legend=‘ajuste’)
p.line(xg,y2,source=source3,line_color=‘black’,legend=‘linea-cte’)

inputs = widgetbox(slider1,slider2,button,sizing_mode = ‘fixed’)

l = layout([
[inputs, p],
], sizing_mode=‘fixed’)

curdoc().add_root(l)
curdoc().title = “pruebas”

``

···

On Saturday, April 22, 2017 at 6:31:22 PM UTC-3, Bryan Van de ven wrote:

Hi,

Can you please provide your complete new code to examine?

Thanks,

Bryan

On Apr 21, 2017, at 23:53, [email protected] wrote:

I am sorry but I am still having trouble with this, is there any way I can retrieve the last value of a set of data from a callback function? Because I found that if I print the source.data inside the callback function, it’s printed everytime I change a slider, but when I want to use the final value I can’t.

For example if the data is x=[2,3,4,5,6,7] and I plot that, and then I change the limits with a slider to see a plot of x=[4,5,6] I want to retrieve x=[4,5,6] to make some calculations with that.

I don’t know if you can tell me how it’s done but I just need to know if you know if this can be done because I tried a million things and nothing seems to work.

Thank you a lot

On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:

The problem is here:

def update():
button_new_data={
‘x’:source_gauss[‘x’],
‘y’:source_gauss[‘y’]
}

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement getitem (which is the error you are seeing). Perhaps you mean

    source_gauss.data['x']

etc.

Thanks,

Bryan


You received this message because you are 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/8f22f86c-c828-4b60-80c2-2768a028891a%40continuum.io.

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

Hi,

This is not really to do with Bokeh. This is the way Python behaves: local variables are only ever visible and usable *inside* a function. They do not exist anymore once a function has returned. You might consider having those variables outside the functions, and using he "global" keyword to allow the function to modify them from inside the function.

Thanks,

Bryan

···

On Apr 22, 2017, at 19:40, [email protected] wrote:

Of course, I tried several ways of doing this, the last one is (I WROTE IN CAPITAL LETTERS IN THE COMMENTS WHAT IS MY PROBLEM):
import numpy as np
import math
from numpy import loadtxt

from bokeh.plotting import figure, output_file, show
from bokeh.layouts import layout, widgetbox,row
from bokeh.models.widgets import Slider, Button
from bokeh.models import ColumnDataSource
from bokeh.io import curdoc

from lmfit.models import GaussianModel
from aju_gauss_test1 import gauss

output_file('mecagoenesto')

data=loadtxt('sn1996cb-19961217.dat')
x0=data[:,0]
x1=np.array(x0).tolist()
y0=data[:,1]
escala=10**(-int(math.log(abs(y0[0]),10)))
y1=np.array(y0*escala).tolist()

def f_n(array,value):
        idx=(np.abs(array-value)).argmin()
        return array[idx]

lp=f_n(np.array(x1),5937.5)
rp=f_n(np.array(x1),6312.5)

x = x1[x1.index(lp):x1.index(rp)]
y = y1[x1.index(lp):x1.index(rp)]

source=ColumnDataSource(data={'x':x, 'y':y})
p=figure(title='prueba',x_axis_label='lambda',y_axis_label='flujo')
p.line(x='x',y='y',source=source,color='blue',legend='linea')

def update_x(attr,old,new):
        
    # Read the current value of the slider: scale
    sv1 = slider1.value
    sv2= slider2.value
    new_x_azul=f_n(np.array(x1),sv1)
    new_x_rojo=f_n(np.array(x1),sv2)
    # Update source with the new data values
    slider_new_data = {
            'x':x1[x1.index(new_x_azul):x1.index(new_x_rojo)],
            'y':y1[x1.index(new_x_azul):x1.index(new_x_rojo)]
    }
    
    source.data=slider_new_data
    #I WANT TO RETRIEVE THE LAST VALUES OF SOURCE DATA, BUT IF I DEFINE:
    #x_for_gauss=source.data['x']
    #y_for_gauss=source.data['y']
    #AND THEN TRY TO USE THEM OUTSIDE THIS FUNCTION I GET A MESSAGE THAT x_for_gauss AND y_for_gauss ARE NOT DEFINE. IF I PRINT THEM HERE THE LAST VALUES OF THE SLIDERS ARE PRINTED (THAT IS WHAT I WANT)

#SO I USE THIS, AND WORKS FOR THE ORGINAL DATA SET, BUT WHEN I PRESS THE BUTTON (I WANT TO MAKE AN ADJUSTMENT WITH THE FINAL DATA SET FROM THE SLIDERS) NOTHING HAPPENS
x_for_gauss=source.data['x']
y_for_gauss=source.data['y']
source_gauss=ColumnDataSource(data={'x':x_for_gauss,'y':y_for_gauss})

def update():
    button_new_data={
    'x':source_gauss.data['x'],
    'y':source_gauss.data['y']
     }

    source_gauss.data=button_new_data

slider1=Slider(start=5750,end=6125,value=5937.5,step=0.1,title='azul')
slider2=Slider(start=6125,end=6500,value=6312.5,step=0.1,title='rojo')

slider1.on_change('value',update_x)
slider2.on_change('value',update_x)

button=Button(label='Make Adjustment')
button.on_click(update)

#HERE IS THE ADJUSTMENT IT IS MADE WITH THE ORIGINAL DATA SET BUT IT DOES NOT UPDATE WHEN I PRESS THE BUTTON
xg,y2,yg=gauss(source.data['x'],source.data['y'])
source2=ColumnDataSource(data={'x':xg, 'y':yg})
source3=ColumnDataSource(data={'x':xg, 'y':y2})
p.line(xg,yg,source=source2,line_color='red',line_dash='dotdash',legend='ajuste')
p.line(xg,y2,source=source3,line_color='black',legend='linea-cte')

inputs = widgetbox(slider1,slider2,button,sizing_mode = 'fixed')

l = layout([
[inputs, p],
], sizing_mode='fixed')

curdoc().add_root(l)
curdoc().title = "pruebas"

On Saturday, April 22, 2017 at 6:31:22 PM UTC-3, Bryan Van de ven wrote:
Hi,

Can you please provide your complete new code to examine?

Thanks,

Bryan

> On Apr 21, 2017, at 23:53, [email protected] wrote:
>
> I am sorry but I am still having trouble with this, is there any way I can retrieve the last value of a set of data from a callback function? Because I found that if I print the source.data inside the callback function, it's printed everytime I change a slider, but when I want to use the final value I can't.
> For example if the data is x=[2,3,4,5,6,7] and I plot that, and then I change the limits with a slider to see a plot of x=[4,5,6] I want to retrieve x=[4,5,6] to make some calculations with that.
> I don't know if you can tell me how it's done but I just need to know if you know if this can be done because I tried a million things and nothing seems to work.
> Thank you a lot
>
>
> On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:
> The problem is here:
>
> > def update():
> > button_new_data={
> > 'x':source_gauss['x'],
> > 'y':source_gauss['y']
> > }
>
> ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement __getitem__ (which is the error you are seeing). Perhaps you mean
>
> source_gauss.data['x']
>
> etc.
>
> Thanks,
>
> Bryan
>
> --
> You received this message because you are 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/8f22f86c-c828-4b60-80c2-2768a028891a%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/f9cb2629-4f2e-4f31-9862-843280c3aa54%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Ok. I’ll try to figure it out. I tried returning the variables in the function but I can not call update_x(attr,old,new) because attr, old, and new are not defined variables.

Thank you very much anyways

···

On Tue, Apr 25, 2017 at 7:57 PM, Bryan Van de ven [email protected] wrote:

Hi,

This is not really to do with Bokeh. This is the way Python behaves: local variables are only ever visible and usable inside a function. They do not exist anymore once a function has returned. You might consider having those variables outside the functions, and using he “global” keyword to allow the function to modify them from inside the function.

Thanks,

Bryan

On Apr 22, 2017, at 19:40, [email protected] wrote:

Of course, I tried several ways of doing this, the last one is (I WROTE IN CAPITAL LETTERS IN THE COMMENTS WHAT IS MY PROBLEM):

import numpy as np

import math

from numpy import loadtxt

from bokeh.plotting import figure, output_file, show

from bokeh.layouts import layout, widgetbox,row

from bokeh.models.widgets import Slider, Button

from bokeh.models import ColumnDataSource

from bokeh.io import curdoc

from lmfit.models import GaussianModel

from aju_gauss_test1 import gauss

output_file(‘mecagoenesto’)

data=loadtxt(‘sn1996cb-19961217.dat’)

x0=data[:,0]

x1=np.array(x0).tolist()

y0=data[:,1]

escala=10**(-int(math.log(abs(y0[0]),10)))

y1=np.array(y0*escala).tolist()

def f_n(array,value):

    idx=(np.abs(array-value)).argmin()
    return array[idx]

lp=f_n(np.array(x1),5937.5)

rp=f_n(np.array(x1),6312.5)

x = x1[x1.index(lp):x1.index(rp)]

y = y1[x1.index(lp):x1.index(rp)]

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

p=figure(title=‘prueba’,x_axis_label=‘lambda’,y_axis_label=‘flujo’)

p.line(x=‘x’,y=‘y’,source=source,color=‘blue’,legend=‘linea’)

def update_x(attr,old,new):

# Read the current value of the slider: scale
sv1 = slider1.value
sv2= slider2.value
new_x_azul=f_n(np.array(x1),sv1)
new_x_rojo=f_n(np.array(x1),sv2)
# Update source with the new data values
slider_new_data = {
        'x':x1[x1.index(new_x_azul):x1.index(new_x_rojo)],
        'y':y1[x1.index(new_x_azul):x1.index(new_x_rojo)]
}
source.data=slider_new_data
#I WANT TO RETRIEVE THE LAST VALUES OF SOURCE DATA, BUT IF I DEFINE:
#x_for_gauss=source.data['x']
#y_for_gauss=source.data['y']
#AND THEN TRY TO USE THEM OUTSIDE THIS FUNCTION I GET A MESSAGE THAT x_for_gauss AND y_for_gauss ARE NOT DEFINE. IF I PRINT THEM HERE THE LAST VALUES OF THE SLIDERS ARE PRINTED (THAT IS WHAT I WANT)

#SO I USE THIS, AND WORKS FOR THE ORGINAL DATA SET, BUT WHEN I PRESS THE BUTTON (I WANT TO MAKE AN ADJUSTMENT WITH THE FINAL DATA SET FROM THE SLIDERS) NOTHING HAPPENS

x_for_gauss=source.data[‘x’]

y_for_gauss=source.data[‘y’]

source_gauss=ColumnDataSource(data={‘x’:x_for_gauss,‘y’:y_for_gauss})

def update():

button_new_data={
'x':source_gauss.data['x'],
'y':source_gauss.data['y']
 }
source_gauss.data=button_new_data

slider1=Slider(start=5750,end=6125,value=5937.5,step=0.1,title=‘azul’)

slider2=Slider(start=6125,end=6500,value=6312.5,step=0.1,title=‘rojo’)

slider1.on_change(‘value’,update_x)

slider2.on_change(‘value’,update_x)

button=Button(label=‘Make Adjustment’)

button.on_click(update)

#HERE IS THE ADJUSTMENT IT IS MADE WITH THE ORIGINAL DATA SET BUT IT DOES NOT UPDATE WHEN I PRESS THE BUTTON

xg,y2,yg=gauss(source.data[‘x’],source.data[‘y’])

source2=ColumnDataSource(data={‘x’:xg, ‘y’:yg})

source3=ColumnDataSource(data={‘x’:xg, ‘y’:y2})

p.line(xg,yg,source=source2,line_color=‘red’,line_dash=‘dotdash’,legend=‘ajuste’)

p.line(xg,y2,source=source3,line_color=‘black’,legend=‘linea-cte’)

inputs = widgetbox(slider1,slider2,button,sizing_mode = ‘fixed’)

l = layout([

[inputs, p],

], sizing_mode=‘fixed’)

curdoc().add_root(l)

curdoc().title = “pruebas”

On Saturday, April 22, 2017 at 6:31:22 PM UTC-3, Bryan Van de ven wrote:

Hi,

Can you please provide your complete new code to examine?

Thanks,

Bryan

On Apr 21, 2017, at 23:53, [email protected] wrote:

I am sorry but I am still having trouble with this, is there any way I can retrieve the last value of a set of data from a callback function? Because I found that if I print the source.data inside the callback function, it’s printed everytime I change a slider, but when I want to use the final value I can’t.

For example if the data is x=[2,3,4,5,6,7] and I plot that, and then I change the limits with a slider to see a plot of x=[4,5,6] I want to retrieve x=[4,5,6] to make some calculations with that.

I don’t know if you can tell me how it’s done but I just need to know if you know if this can be done because I tried a million things and nothing seems to work.

Thank you a lot

On Thursday, April 20, 2017 at 3:16:21 AM UTC-3, Bryan Van de ven wrote:

The problem is here:

def update():

button_new_data={
        'x':source_gauss['x'],
        'y':source_gauss['y']
}

ColumnDataSource objects do not respond to the square brackets. They are not array or dictionaries and specifically, do not implement getitem (which is the error you are seeing). Perhaps you mean

    source_gauss.data['x']

etc.

Thanks,

Bryan

You received this message because you are 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/8f22f86c-c828-4b60-80c2-2768a028891a%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.

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

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/f9cb2629-4f2e-4f31-9862-843280c3aa54%40continuum.io.

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

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/e3_WupazIyQ/unsubscribe.

To unsubscribe from this group and all its topics, 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/E1A0BFC2-4343-4152-B00D-57DB8A90249B%40continuum.io.