How to display text

I’m having some difficulty overlaying text on a plot. I’m using the “text” method of the “figure” class like so: p.text(x=100, y=100, text={“field”:“Hello World”}). Unfortunately, it shows up on the plot as NaN. I can’t find any additional insight in the documentation, so I thought I’d ask here. What’s the best/preferred way to create plot text strings?

pass it in as a list and it works:
p.text(x=100, y=100, text=[“Hello World”])

···

On Wed, May 27, 2015 at 1:05 PM [email protected] wrote:

I’m having some difficulty overlaying text on a plot. I’m using the “text” method of the “figure” class like so: p.text(x=100, y=100, text={“field”:“Hello World”}). Unfortunately, it shows up on the plot as NaN. I can’t find any additional insight in the documentation, so I thought I’d ask here. What’s the best/preferred way to create plot text strings?

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/5025489b-44d1-49e4-8db8-70714ad41793%40continuum.io.

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

Excellent! Works like a charm - thank you!

Let me ask a follow-up question. I’m following the Unemployment example (http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html), and what I’d like to do is superimpose text on top of the rectangles. The text I create, however, is hidden behind them. Is there a transparency setting, or a foreground/background control?

···

On Wednesday, May 27, 2015 at 10:18:44 AM UTC-7, Jared Thompson wrote:

pass it in as a list and it works:
p.text(x=100, y=100, text=[“Hello World”])

On Wed, May 27, 2015 at 1:05 PM [email protected] wrote:

I’m having some difficulty overlaying text on a plot. I’m using the “text” method of the “figure” class like so: p.text(x=100, y=100, text={“field”:“Hello World”}). Unfortunately, it shows up on the plot as NaN. I can’t find any additional insight in the documentation, so I thought I’d ask here. What’s the best/preferred way to create plot text strings?

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/5025489b-44d1-49e4-8db8-70714ad41793%40continuum.io.

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

Note, I have not tested this with your example, only referring to past things I have done.

It matters in what order you render the objects, so if you put the text part at the bottom of your script eg) after you do the rectangles, then the text should render above them in the plot.

···

On Wed, May 27, 2015 at 1:32 PM [email protected] wrote:

Excellent! Works like a charm - thank you!

Let me ask a follow-up question. I’m following the Unemployment example (http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html), and what I’d like to do is superimpose text on top of the rectangles. The text I create, however, is hidden behind them. Is there a transparency setting, or a foreground/background control?

On Wednesday, May 27, 2015 at 10:18:44 AM UTC-7, Jared Thompson wrote:

pass it in as a list and it works:
p.text(x=100, y=100, text=[“Hello World”])

On Wed, May 27, 2015 at 1:05 PM [email protected] wrote:

I’m having some difficulty overlaying text on a plot. I’m using the “text” method of the “figure” class like so: p.text(x=100, y=100, text={“field”:“Hello World”}). Unfortunately, it shows up on the plot as NaN. I can’t find any additional insight in the documentation, so I thought I’d ask here. What’s the best/preferred way to create plot text strings?

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/5025489b-44d1-49e4-8db8-70714ad41793%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/fb4811af-a51b-4865-87d6-55ec4d53c38e%40continuum.io.

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

Jonathan,

I just did a trivial example to prove that point.

(mine is in an ipython notebook)

#note in this example you will see the text as it is rendered after (and above) the rectangle

import bokeh.plotting as bp

p = bp.figure()

bp.output_notebook()

p.rect(0,0,15,15)

p.text(x=3, y=3, text=[“Hello World”])

bp.show§

vs.

#notice here you will not see the text as it is rendered before (and thus behind) the rectangle

import bokeh.plotting as bp

p = bp.figure()

bp.output_notebook()

p.text(x=3, y=3, text=[“Hello World”])

p.rect(0,0,15,15)

bp.show§

···

On Wed, May 27, 2015 at 2:27 PM jared [email protected] wrote:

Note, I have not tested this with your example, only referring to past things I have done.

It matters in what order you render the objects, so if you put the text part at the bottom of your script eg) after you do the rectangles, then the text should render above them in the plot.

On Wed, May 27, 2015 at 1:32 PM [email protected] wrote:

Excellent! Works like a charm - thank you!

Let me ask a follow-up question. I’m following the Unemployment example (http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html), and what I’d like to do is superimpose text on top of the rectangles. The text I create, however, is hidden behind them. Is there a transparency setting, or a foreground/background control?

On Wednesday, May 27, 2015 at 10:18:44 AM UTC-7, Jared Thompson wrote:

pass it in as a list and it works:
p.text(x=100, y=100, text=[“Hello World”])

On Wed, May 27, 2015 at 1:05 PM [email protected] wrote:

I’m having some difficulty overlaying text on a plot. I’m using the “text” method of the “figure” class like so: p.text(x=100, y=100, text={“field”:“Hello World”}). Unfortunately, it shows up on the plot as NaN. I can’t find any additional insight in the documentation, so I thought I’d ask here. What’s the best/preferred way to create plot text strings?

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/5025489b-44d1-49e4-8db8-70714ad41793%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 bokeh+unsubscr[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/fb4811af-a51b-4865-87d6-55ec4d53c38e%40continuum.io.

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