Add values to figure according to categorical y-axis

Hello,

I wondered if its possible to add markers to a figure refering to the catecorical y-axis. This is the example:

from bokeh.plotting import figure, output_file, show

factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
x = [50, 40, 65, 10, 25, 37, 80, 60]

output_file("categorical.html")

p = figure(y_range=factors)

p.circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3)

show(p)

And I would like to do something like this:

p.triangle(x=x_value, y=“a”)

so the triangle shows up at the coordinates (x_value,“a”)

Best regards,
Charlotte

Hi,

By default, strings are interpreted as column names. This is the best correct thing in the majority of situations, but there are a a few ambiguous cases where it can be ambiguous (basically whenever a string could also be a value). You probably will need to tell Bokeh explicitly that "a" is a value, and not a column name:

  from bokeh.core.properties import value

  p.triangle(x=x_value, y=value("a"))

Thanks,

Bryan

···

On Feb 13, 2017, at 09:54, [email protected] wrote:

Hello,

I wondered if its possible to add markers to a figure refering to the catecorical y-axis. This is the example:

from bokeh.plotting import figure, output_file, show

factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
x = [50, 40, 65, 10, 25, 37, 80, 60]

output_file("categorical.html")

p = figure(y_range=factors)

p.circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3)

show(p)

And I would like to do something like this:

p.triangle(x=x_value, y="a")

so the triangle shows up at the coordinates (x_value,"a")

Best regards,
Charlotte

--
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/65c1e107-9310-412e-b577-992f0d440822%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hey,

thanks for this quick reply!

Now it gives me the following error:

···
Number property 'y' given invalid value: a

Am Montag, 13. Februar 2017 17:01:36 UTC+1 schrieb Bryan Van de ven:

Hi,

By default, strings are interpreted as column names. This is the best correct thing in the majority of situations, but there are a a few ambiguous cases where it can be ambiguous (basically whenever a string could also be a value). You probably will need to tell Bokeh explicitly that “a” is a value, and not a column name:

    from bokeh.core.properties import value



    p.triangle(x=x_value, y=value("a"))

Thanks,

Bryan

On Feb 13, 2017, at 09:54, [email protected] wrote:

Hello,

I wondered if its possible to add markers to a figure refering to the catecorical y-axis. This is the example:

from bokeh.plotting import figure, output_file, show

factors = [“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”]

x = [50, 40, 65, 10, 25, 37, 80, 60]

output_file(“categorical.html”)

p = figure(y_range=factors)

p.circle(x, factors, size=15, fill_color=“orange”, line_color=“green”, line_width=3)

show(p)

And I would like to do something like this:

p.triangle(x=x_value, y=“a”)

so the triangle shows up at the coordinates (x_value,“a”)

Best regards,

Charlotte


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/65c1e107-9310-412e-b577-992f0d440822%40continuum.io.

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

Hrm, this seems like a bug. Please file a bug report on GitHub with a complete code sample to reproduce. In the mean time, the best workaround I can offer is:

   p.triangle(x=x_value, y=v['a']*len(x))

which I confirmed worked.

Thanks,

Bryan

···

On Feb 13, 2017, at 10:19, C <[email protected]> wrote:

Hey,

thanks for this quick reply!

Now it gives me the following error:

Number property 'y' given invalid value: a

Am Montag, 13. Februar 2017 17:01:36 UTC+1 schrieb Bryan Van de ven:
Hi,

By default, strings are interpreted as column names. This is the best correct thing in the majority of situations, but there are a a few ambiguous cases where it can be ambiguous (basically whenever a string could also be a value). You probably will need to tell Bokeh explicitly that "a" is a value, and not a column name:

        from bokeh.core.properties import value

        p.triangle(x=x_value, y=value("a"))

Thanks,

Bryan

> On Feb 13, 2017, at 09:54, workmail...@gmail.com wrote:
>
> Hello,
>
> I wondered if its possible to add markers to a figure refering to the catecorical y-axis. This is the example:
>
> from bokeh.plotting import figure, output_file, show
>
>
>
> factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
> x = [50, 40, 65, 10, 25, 37, 80, 60]
>
>
>
> output_file("categorical.html")
>
>
>
> p = figure(y_range=factors)
>
>
>
> p.circle(x, factors, size=15, fill_color="orange", line_color="green", line_width=3)
>
>
>
> show(p)
>
> And I would like to do something like this:
>
> p.triangle(x=x_value, y="a")
>
> so the triangle shows up at the coordinates (x_value,"a")
>
> Best regards,
> Charlotte
>
> --
> 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+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/65c1e107-9310-412e-b577-992f0d440822%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/fd575e4d-65e6-41af-be5c-af5c9cd16d27%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I’m not sure what is meant by v[‘a’] ?

I’ll file a bug report!

Thanks,

Charlotte

···

2017-02-13 17:43 GMT+01:00 Bryan Van de ven [email protected]:

Hrm, this seems like a bug. Please file a bug report on GitHub with a complete code sample to reproduce. In the mean time, the best workaround I can offer is:

     p.triangle(x=x_value, y=v['a']*len(x))

which I confirmed worked.

Thanks,

Bryan

On Feb 13, 2017, at 10:19, C [email protected] wrote:

Hey,

thanks for this quick reply!

Now it gives me the following error:

Number property ‘y’ given invalid value: a

Am Montag, 13. Februar 2017 17:01:36 UTC+1 schrieb Bryan Van de ven:

Hi,

By default, strings are interpreted as column names. This is the best correct thing in the majority of situations, but there are a a few ambiguous cases where it can be ambiguous (basically whenever a string could also be a value). You probably will need to tell Bokeh explicitly that “a” is a value, and not a column name:

    from bokeh.core.properties import value
    p.triangle(x=x_value, y=value("a"))

Thanks,

Bryan

On Feb 13, 2017, at 09:54, [email protected] wrote:

Hello,

I wondered if its possible to add markers to a figure refering to the catecorical y-axis. This is the example:

from bokeh.plotting import figure, output_file, show

factors = [“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”]

x = [50, 40, 65, 10, 25, 37, 80, 60]

output_file(“categorical.html”)

p = figure(y_range=factors)

p.circle(x, factors, size=15, fill_color=“orange”, line_color=“green”, line_width=3)

show(p)

And I would like to do something like this:

p.triangle(x=x_value, y=“a”)

so the triangle shows up at the coordinates (x_value,“a”)

Best regards,

Charlotte

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/65c1e107-9310-412e-b577-992f0d440822%40continuum.io.

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

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

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

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/fd575e4d-65e6-41af-be5c-af5c9cd16d27%40continuum.io.

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

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/QenbMcW6oV8/unsubscribe.

To unsubscribe from this group and all its topics, 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/4BE37290-7E06-4036-BBFF-0BE2CE827849%40continuum.io.