creating plots with different x,y - aka "manually setting the DataSource"

Hi,

I’m trying to somehow plot “subplots”, having different x,y values. The grid example is great for the geometry of the output. But no example shows how to create the DataSource from scratch and to pass the column names as args to line() or scatter().

I’ve tried something like that to initialize my plots (which will then be updated/animated)

x = {}
y = {}

ds = DataSource()


for id in ids:
    ds["x_%s"%id] = [0,]
    ds["y_%s"%id] = [0,]

    line("x_%s"%id,"y_%s"%id, color="#0000FF", tools="pan,zoom,resize",
        width=1280,height=200,
        x_axis_type = "datetime",
        title=id
        )

Thanks for the help :slight_smile:

Thom

Hi Thomas,

It *should* just work by adding a “source” keyword argument to the renderer call, like this:

flowers = ColumnDataSource(
    data=dict(
        petal_length=flowers['petal_length'],
        petal_width=flowers['petal_width'],
        sepal_length=flowers['sepal_length'],
        sepal_width=flowers['sepal_width'],
        iris_color=flowers['color'],
    )
)

scatter("petal_length", “petal_width”, color="iris_color", fill_alpha=0.2, radius=5, name="iris", source=flowers)

However, I just discovered a small bug in testing out this example for you. I have created a GH issue you can track this problem on:

  https://github.com/ContinuumIO/bokeh/issues/155

I hope to have it fixed in GH this afternoon, and FYI we are planning a 0.3 follow on release next week, that is mostly a build system refactor and repository consolidation, but that will also contain several bug fixes as well.

Thanks!

Bryan

···

On Nov 7, 2013, at 8:43 AM, Thomas Lecocq <[email protected]> wrote:

Hi,

I'm trying to somehow plot "subplots", having different x,y values. The grid example is great for the geometry of the output. But no example shows how to create the DataSource from scratch and to pass the column names as args to line() or scatter().

I've tried something like that to initialize my plots (which will then be updated/animated)

    x = {}
    y = {}
    
    ds = DataSource()
    
    for id in ids:
        ds["x_%s"%id] = [0,]
        ds["y_%s"%id] = [0,]

        line("x_%s"%id,"y_%s"%id, color="#0000FF", tools="pan,zoom,resize",
            width=1280,height=200,
            x_axis_type = "datetime",
            title=id
            )

Thanks for the help :slight_smile:

Thom

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion" 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/94e29c5b-e1be-46d1-9c7a-80c96c952ba0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/groups/opt_out.

Thomas, I have pushed a change to GH master that should fix this problem an allow the code below (and in the issue #155) to function properly. Please let me know if it works for you,

Thanks,

Bryan

···

On Nov 7, 2013, at 11:11 AM, Bryan Van de Ven <[email protected]> wrote:

Hi Thomas,

It *should* just work by adding a “source” keyword argument to the renderer call, like this:

flowers = ColumnDataSource(
   data=dict(
       petal_length=flowers['petal_length'],
       petal_width=flowers['petal_width'],
       sepal_length=flowers['sepal_length'],
       sepal_width=flowers['sepal_width'],
       iris_color=flowers['color'],
   )
)

scatter("petal_length", “petal_width”, color="iris_color", fill_alpha=0.2, radius=5, name="iris", source=flowers)

However, I just discovered a small bug in testing out this example for you. I have created a GH issue you can track this problem on:

  https://github.com/ContinuumIO/bokeh/issues/155

I hope to have it fixed in GH this afternoon, and FYI we are planning a 0.3 follow on release next week, that is mostly a build system refactor and repository consolidation, but that will also contain several bug fixes as well.

Thanks!

Bryan

On Nov 7, 2013, at 8:43 AM, Thomas Lecocq <[email protected]> wrote:

Hi,

I'm trying to somehow plot "subplots", having different x,y values. The grid example is great for the geometry of the output. But no example shows how to create the DataSource from scratch and to pass the column names as args to line() or scatter().

I've tried something like that to initialize my plots (which will then be updated/animated)

   x = {}
   y = {}

   ds = DataSource()

   for id in ids:
       ds["x_%s"%id] = [0,]
       ds["y_%s"%id] = [0,]

       line("x_%s"%id,"y_%s"%id, color="#0000FF", tools="pan,zoom,resize",
           width=1280,height=200,
           x_axis_type = "datetime",
           title=id
           )

Thanks for the help :slight_smile:

Thom

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion" 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/94e29c5b-e1be-46d1-9c7a-80c96c952ba0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/groups/opt_out.