☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Bokeh Server with 3 y axes doesn't plot,but does for 2 y axes.Why?

Community Support
revoltman
revoltman

My objective is to plot live data on multiple y axes(different ranges). The following code worked with 2 y axes but when I added a 3rd one, the browser was just a blank.An earlier basic bokeh plot with 4 y axes worked fine but this server version is not working.I dont know what mistake I am doing,please guide me.

The following code plots 2 temporary points then a 3rd permanent point. Uses ‘patch’ and ‘stream’ from ColumnDataSource to achieve this.
Please download the attached files.

from bokeh.io import curdoc
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.models import LinearAxis, Range1d
import numpy as np
def plotcharts(source,x,a,b,c):
    fig=figure(y_range=(0, 500))
    fig.circle(source=source, x=x,y=a,size=12,color='red')

    fig.extra_y_ranges = {"foo1": Range1d(start=0, end=50)}
    fig.circle(source=source,x=x, y=b, size=12, color="blue",
    y_range_name="foo1")
    fig.add_layout(LinearAxis(y_range_name="foo1"), 'left')

    # configure 3rd axis
    fig.extra_y_ranges = {"foo2": Range1d(start=0, end=25)}
    fig.circle(source=source, x=x, y=c, color="magenta",
    y_range_name="foo2")
    fig.add_layout(LinearAxis(y_range_name="foo2"), 'right')

    return fig
count=(-1)
dct=dict(x=[],a=[],b=[],c=[])
#Just a and b work fine but when 3rd axis c was added it doesnt !
source=ColumnDataSource(dct)
fig=plotcharts(source,'x','a','b','c') #c==3rd axis

def update_data():
    global count
count=count+1
    y1 = np.random.randint(low=0, high=500)
    y2 = np.random.randint(low=0, high=50)
    y3 = np.random.randint(low=0, high=25) #y3==3rd axis

    if count%3==0:
        new_data = {
            'x': [count/3],
            'a': [y1],
            'b': [y2],
            'c': [y3]  #c==3rd axis
        }
        source.stream(new_data,rollover=20)

    else:
        l = len(df['a'])
        new_data = {
            'a': [(l - 1,y1)],
            'b': [(l - 1, y2)],
            'c': [(l - 1, y3)]  #c==3rd axis
        }
        source.patch(new_data)

curdoc().add_root(fig)
curdoc().add_periodic_callback(update_data,1000)

⌁   Link to post
Bryan
Bryan

Property values that are dicts have always been too easy to misconfigure. We've gotten rid of most other instances of them, but I don't think we can in this case. But, we could probably add a convenience method to Figure for adding new ranges so that users don't have to much with the dictionary directly. I'd suggest making an issue on GitHub about this.

Thanks,

Bryan

···

On Jan 25, 2018, at 10:22, revoltman <revoltman2018@gmail.com> wrote:

Yes, Thanks Eugene for your help.
Last time bigreddot(from stackoverflow) had pointed out this same mistake. I didnt learn :frowning:
Thanks again.

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/682fd6da-82df-4030-89db-5bcae544b7e6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled