Tabbed plots require a unique source?

I’m trying to collate similar, but different, plots, based on the same data source, into a single page with the tabbed pane layout.

Initially, I’m just trying to plot two scatter ones. They use different axes, but the source dataframe is meant to be the same. However, unless I created two unique source instances, it would only plot the second plot - in both tabs.

source = ColumnDataSource(data)

source2 = ColumnDataSource(data)

p1 = figure(tools=TOOLS, title=y[:-9])

p1.scatter(x=OC, y=HC,source=source,radius=radii, color =‘mz’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab1 = Panel(child=p1, title=“Plot1”)

p2 = figure(tools=TOOLS, title=y[:-9])

p2.scatter(x=Cno, y=DBE,source=source2,radius=radii, color =‘Ono’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab2 = Panel(child=p2, title=“Plot2”)

tabs = Tabs(tabs=[ tab1, tab2 ])

output_file(path+“two-plot.html”, title=“test”)

show(tabs) # open a browser

``

When I have source=source for both (and no source2), both tabs show the second plot.

Is this a feature or a bug?
Is it because they are both scatter plots?

Are OC, DBE, etc the string names of columns in the data source? Or actual arrays/lists? If the latter then the default-created columns are probably overwriting each other! We are probably going to disallow mixing “literal arrays” and supplied data sources, for this reason. Try putting the data columns in the data source, and then use x=“the_column_name” instead.

Thanks,

Bryan

···

On May 4, 2016, at 15:51, [email protected] wrote:

I’m trying to collate similar, but different, plots, based on the same data source, into a single page with the tabbed pane layout.

Initially, I’m just trying to plot two scatter ones. They use different axes, but the source dataframe is meant to be the same. However, unless I created two unique source instances, it would only plot the second plot - in both tabs.

source = ColumnDataSource(data)

source2 = ColumnDataSource(data)

p1 = figure(tools=TOOLS, title=y[:-9])

p1.scatter(x=OC, y=HC,source=source,radius=radii, color =‘mz’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab1 = Panel(child=p1, title=“Plot1”)

p2 = figure(tools=TOOLS, title=y[:-9])

p2.scatter(x=Cno, y=DBE,source=source2,radius=radii, color =‘Ono’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab2 = Panel(child=p2, title=“Plot2”)

tabs = Tabs(tabs=[ tab1, tab2 ])

output_file(path+“two-plot.html”, title=“test”)

show(tabs) # open a browser

``

When I have source=source for both (and no source2), both tabs show the second plot.

Is this a feature or a bug?
Is it because they are both scatter plots?

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/a3dbeea6-bf66-4353-8817-9ed9be86ccb8%40continuum.io.

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

More (possibly useful) info:

https://github.com/bokeh/bokeh/issues/2056

Thanks,

Bryan

···

On May 4, 2016, at 16:01, Bryan Van de Ven [email protected] wrote:

Are OC, DBE, etc the string names of columns in the data source? Or actual arrays/lists? If the latter then the default-created columns are probably overwriting each other! We are probably going to disallow mixing “literal arrays” and supplied data sources, for this reason. Try putting the data columns in the data source, and then use x=“the_column_name” instead.

Thanks,

Bryan

On May 4, 2016, at 15:51, [email protected] wrote:

I’m trying to collate similar, but different, plots, based on the same data source, into a single page with the tabbed pane layout.

Initially, I’m just trying to plot two scatter ones. They use different axes, but the source dataframe is meant to be the same. However, unless I created two unique source instances, it would only plot the second plot - in both tabs.

source = ColumnDataSource(data)

source2 = ColumnDataSource(data)

p1 = figure(tools=TOOLS, title=y[:-9])

p1.scatter(x=OC, y=HC,source=source,radius=radii, color =‘mz’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab1 = Panel(child=p1, title=“Plot1”)

p2 = figure(tools=TOOLS, title=y[:-9])

p2.scatter(x=Cno, y=DBE,source=source2,radius=radii, color =‘Ono’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab2 = Panel(child=p2, title=“Plot2”)

tabs = Tabs(tabs=[ tab1, tab2 ])

output_file(path+“two-plot.html”, title=“test”)

show(tabs) # open a browser

``

When I have source=source for both (and no source2), both tabs show the second plot.

Is this a feature or a bug?
Is it because they are both scatter plots?

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/a3dbeea6-bf66-4353-8817-9ed9be86ccb8%40continuum.io.

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

You 100% can use two plots in tabs from the same data source
(I’ve done it).

It’s probably just a problem with your code as Bryan indicated.

Best,

Bird

···

On 5/4/16 2:01 PM, Bryan Van de Ven
wrote:

    Are OC, DBE, etc the string names of columns in the data

source? Or actual arrays/lists? If the latter then the
default-created columns are probably overwriting each other! We
are probably going to disallow mixing “literal arrays” and
supplied data sources, for this reason. Try putting the data
columns in the data source, and then use x=“the_column_name”
instead.

Thanks,

Bryan

    On May 4, 2016, at 15:51, [email protected] wrote:
        I'm trying to collate similar, but different,

plots, based on the same data source, into a single page
with the tabbed pane layout.

        Initially, I'm just trying to plot two scatter ones. They

use different axes, but the source dataframe is meant to be
the same. However, unless I created two unique source
instances, it would only plot the second plot - in both
tabs.

                    source = ColumnDataSource(data)
                    source2 =

ColumnDataSource(data)

                    p1 =

figure(tools=TOOLS, title=y[:-9])

                    p1.scatter(x=OC,

y=HC,source=source,radius=radii, color
=‘mz’,fill_color=colors,
fill_alpha=0.75,line_color=None)

                    tab1 = Panel(child=p1,

title=“Plot1”)

                    p2 =

figure(tools=TOOLS, title=y[:-9])

                    p2.scatter(x=Cno,

y=DBE,source=source2,radius=radii, color
=‘Ono’,fill_color=colors,
fill_alpha=0.75,line_color=None)

                    tab2 = Panel(child=p2,

title=“Plot2”)

                    tabs = Tabs(tabs=[

tab1, tab2 ])

                    output_file(path+"two-plot.html",

title=“test”)

                    show(tabs)  # open a

browser

``

          When I have source=source for both (and no source2),

both tabs show the second plot.

          Is this a feature or a bug?  

          Is it because they are both scatter plots?

      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           .

To view this discussion on the web visit .
For more options, visit .

  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/A3AAE282-21B1-444B-B4B6-88B10F119C51%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/a3dbeea6-bf66-4353-8817-9ed9be86ccb8%40continuum.io
https://groups.google.com/a/continuum.io/d/optout
https://groups.google.com/a/continuum.io/d/msgid/bokeh/A3AAE282-21B1-444B-B4B6-88B10F119C51%40continuum.io
https://groups.google.com/a/continuum.io/d/optout

That seems to be it - for a number of reasons, I had extracted columns to lists…

I’ve rejigged my code and now the X and Y for both point to columns in a source - and it works OK.

For reference, radius is also affected by this - if the two plots use the same source, the radius (if an actual array/list) is the same for both, regardless of what you specify.
This may be more of an issue because of the way bokeh deals with scatter point sizes, but I think thats another issue…

Thanks

···

On Wednesday, 4 May 2016 22:01:35 UTC+1, Bryan Van de ven wrote:

Are OC, DBE, etc the string names of columns in the data source? Or actual arrays/lists? If the latter then the default-created columns are probably overwriting each other! We are probably going to disallow mixing “literal arrays” and supplied data sources, for this reason. Try putting the data columns in the data source, and then use x=“the_column_name” instead.

Thanks,

Bryan

On May 4, 2016, at 15:51, [email protected] wrote:

I’m trying to collate similar, but different, plots, based on the same data source, into a single page with the tabbed pane layout.

Initially, I’m just trying to plot two scatter ones. They use different axes, but the source dataframe is meant to be the same. However, unless I created two unique source instances, it would only plot the second plot - in both tabs.

source = ColumnDataSource(data)

source2 = ColumnDataSource(data)

p1 = figure(tools=TOOLS, title=y[:-9])

p1.scatter(x=OC, y=HC,source=source,radius=radii, color =‘mz’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab1 = Panel(child=p1, title=“Plot1”)

p2 = figure(tools=TOOLS, title=y[:-9])

p2.scatter(x=Cno, y=DBE,source=source2,radius=radii, color =‘Ono’,fill_color=colors, fill_alpha=0.75,line_color=None)

tab2 = Panel(child=p2, title=“Plot2”)

tabs = Tabs(tabs=[ tab1, tab2 ])

output_file(path+“two-plot.html”, title=“test”)

show(tabs) # open a browser

``

When I have source=source for both (and no source2), both tabs show the second plot.

Is this a feature or a bug?
Is it because they are both scatter plots?

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/a3dbeea6-bf66-4353-8817-9ed9be86ccb8%40continuum.io.

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