ColumnDataSource on keyword argument?

i’m successfully using ColumnDataSource to dynamically change the ‘y’ of a plot.line(). i would also like to change it’s line_color, which is a keyword argument. the usual pattern with a ColumnDataSource is not working. is there a way? thanks.

Hi,

Sorry, I don't really understand what it is you are attempting, in terms of actual code, from that description. Providing some real code snippets is the best way to help others help you.

Thanks,

Bryan

···

On Oct 26, 2018, at 08:00, [email protected] wrote:

i'm successfully using ColumnDataSource to dynamically change the 'y' of a plot.line(). i would also like to change it's line_color, which is a keyword argument. the usual pattern with a ColumnDataSource is not working. is there a way? thanks.

--
You received this message because you are 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/59067a4b-d9cb-485e-b28f-48a4ff8b0f15%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

in a preamble i do this:

wav_source = ColumnDataSource(data=dict(x=, y=))

p_wav.line(‘x’, ‘y’, source=wav_sources)

then later on in a callback i do this:

wav_source.data.update(x=xdata, y=ydata)

how do i change line_color too?

Hi,

Line only draws one line, so it only has one color. You probably want:

  r = p_wav.line('x', 'y', source=wav_sources)

then later:

  r.glyph.line_color = new_color

If that's not what you are are looking for then more information is needed about exactly what your situation is.

Thanks,

Bryan

···

On Oct 26, 2018, at 09:58, [email protected] wrote:

in a preamble i do this:

        wav_source = ColumnDataSource(data=dict(x=, y=))
        p_wav.line('x', 'y', source=wav_sources)

then later on in a callback i do this:

        wav_source.data.update(x=xdata, y=ydata)

how do i change line_color too?

--
You received this message because you are 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/4f3a6990-cdcc-4659-b3bc-9a2ab1a11506%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Thanks for getting back to me. In terms of code. Here is what works:

Initialize the source

source = ColumnDataSource(dict(time=np.zeros(10), y= np.zeros(10))

Now use these quantities to plot some figures

fig = figure(… details…)

fig.line(x=‘time’, y=‘y’, source=source)

Now for each iteration in the my update function

def update(t):

···

On Friday, 26 October 2018 11:49:26 UTC-4, Bryan Van de ven wrote:

Hi,

Sorry, I don’t really understand what it is you are attempting, in terms of actual code, from that description. Providing some real code snippets is the best way to help others help you.

Thanks,

Bryan

On Oct 26, 2018, at 08:00, [email protected] wrote:

i’m successfully using ColumnDataSource to dynamically change the ‘y’ of a plot.line(). i would also like to change it’s line_color, which is a keyword argument. the usual pattern with a ColumnDataSource is not working. is there a way? thanks.


You received this message because you are 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/59067a4b-d9cb-485e-b28f-48a4ff8b0f15%40continuum.io.

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