Linking data in scatter plot and bar chart

Hi All,
My data is like:

id, x, y, type

1, 4, 7, 737

2, 8, 3, 747

3, 9, 9, 737

4, 2, 8, 747

5, 2, 1, 737

I make a scatter plot based on the x and Y and a bar chart based on type.

How can I make a scatter plot linked to a bar chart ?

I either select a dot and get the linked bar or I select a bar and get the linked dots selected.

Thanks !

Arthur

Can you post the code you have so far that makes bar chart and the scatter and then maybe we can help with the linked selection.

···

On Sat, May 23, 2015 at 7:20 AM, Arthur Dijkstra [email protected] wrote:

Hi All,
My data is like:

id, x, y, type

1, 4, 7, 737

2, 8, 3, 747

3, 9, 9, 737

4, 2, 8, 747

5, 2, 1, 737

I make a scatter plot based on the x and Y and a bar chart based on type.

How can I make a scatter plot linked to a bar chart ?

I either select a dot and get the linked bar or I select a bar and get the linked dots selected.

Thanks !

Arthur

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/e9408510-2d14-4d64-97ab-cfb82cfc3b17%40continuum.io.

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

Hi,
Here is my code sofar. My ‘problem’ is that the data source columns for the histogram has not the same length as the columns for the scatter.

from bokeh.plotting import figure, output_file, show, ColumnDataSource, hplot
from collections import Counter

output_file("histo-scatter_selection.html")
id = [1,2,3,4,5]
x = [4,8,9,2,2]
y = [7,3,9,8,1]
type = ["737", "747", "737", "747", "737"]
types = Counter(type)
left = [i for i in range(1,(1+len(types.most_common())))]
top = [i[1] for i in types.most_common()]
right = [p+0.5 for p in left]

source = ColumnDataSource(data=dict(id=id,x=x,y=y, type=type))

TOOLS = "wheel_zoom,box_zoom,box_select,lasso_select,reset,hover,tap,pan"

his = figure(width=300, height=300, tools=TOOLS)
his.quad(top=top, bottom=0, left=left, right=right)

scat = figure(width=300, height=300, tools=TOOLS)
scat.circle(x='x', y='y', source=source)

show(hplot(his, scat))

Thanks for your help !
···

Op zondag 24 mei 2015 01:06:47 UTC+2 schreef Sarah Bird:

Can you post the code you have so far that makes bar chart and the scatter and then maybe we can help with the linked selection.

On Sat, May 23, 2015 at 7:20 AM, Arthur Dijkstra [email protected] wrote:

Hi All,
My data is like:

id, x, y, type

1, 4, 7, 737

2, 8, 3, 747

3, 9, 9, 737

4, 2, 8, 747

5, 2, 1, 737

I make a scatter plot based on the x and Y and a bar chart based on type.

How can I make a scatter plot linked to a bar chart ?

I either select a dot and get the linked bar or I select a bar and get the linked dots selected.

Thanks !

Arthur

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/e9408510-2d14-4d64-97ab-cfb82cfc3b17%40continuum.io.

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