ColumnDataSource with different lengths

Hi Bryan,

I have a question about using different lengths of data in streaming plots via the bokeh server. Here is what I have now

create the source

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

Now create the plot

fig = figure(… details…)

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

now during each update

def update(t):

newData = dict(time=[t],x=“new value”)

source.stream(newData,rollover=10)

However, now I want to add a second plot, a histogram. This time I dont want the data in there to roll, I just want it to accumulate. So in effect:

create the source

source = ColumnDataSource(dict(time=np.zeros(10), x=np.zeros(10),otherData=np.zeros(arbitrary)))

Now create the plot

fig = figure(… details…)

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

fig2 = figure(… details…)
fig2.histogram(data=‘otherData’, source=source)

update

def update(t):

newData = dict(time=[t],x=“new value”, otherData=“new value”)

source.stream(newData,rollover=10, dont roll over other data)

Is this possible? If all arrays in the ColumnDataSource must be the same length, can I push 2 ColumnDataSourcess in source.stream()?

Thanks a lot in advance for the help!

(Answered in the other thread)

···

On Nov 5, 2018, at 11:40, [email protected] wrote:

Hi Bryan,

I have a question about using different lengths of data in streaming plots via the bokeh server. Here is what I have now

# create the source
source = ColumnDataSource(dict(time=np.zeros(10), x=np.zeros(10)))

# Now create the plot
fig = figure(.... details...)
fig.plot(x='time',y='x', source=source)

# now during each update
def update(t):
      newData = dict(time=[t],x="new value")
      source.stream(newData,rollover=10)

However, now I want to add a second plot, a histogram. This time I dont want the data in there to roll, I just want it to accumulate. So in effect:

# create the source
source = ColumnDataSource(dict(time=np.zeros(10), x=np.zeros(10),otherData=np.zeros(arbitrary)))

# Now create the plot
fig = figure(.... details...)
fig.plot(x='time',y='x', source=source)

fig2 = figure(.... details...)
fig2.histogram(data='otherData', source=source)

# update
def update(t):
      newData = dict(time=[t],x="new value", otherData="new value")
      source.stream(newData,rollover=10, dont roll over other data)

Is this possible? If all arrays in the ColumnDataSource must be the same length, can I push 2 ColumnDataSourcess in source.stream()?

Thanks a lot in advance for the help!

--
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/8e2a71f9-bada-48f6-aaf1-e2f0c6441b6d%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.