Space after colon in tooltips

I’m struggling to get a blank space after the colon in tooltips. My code looks like:

hover = p.select(dict(type=HoverTool))

hover.tooltips = [

(“Cluster”, “@cluster”),

("(RA, Dec)", “(@x, @y)”),

(“L [0.1-2.4 keV]”, “(@lx \u00B1 @lx_err) x 1E+44 erg/s”),

(“P [1.4 GHz]”, “(@pow \u00B1 @pow_err) x 1E+24 W/Hz”),

(“YSZ”, “(@y500 \u00B1 @y500_err) x 1E-04 Mpc\u2009\u00B2”),

]

which produces an output that looks like this:

Instead, I would like the text to appear as:

Cluster: MACS J0717.5+3745

(RA, Dec): (07:17:33.8, +37:45:20)

and so on.

The strange thing is that I’ve used Bokeh for another figure, and there the space was automatically added after the colon. The tooltips for the two figures are very similar.

A workaround I’ve found is to add some space in unicode, e.g., \u2003 (the normal space, \u0020, doesn’t work). But I don’t understand why the space automatically appears in some plots and not in others.

Have you tried putting a space at the start of the second tuple item?:

     hover.tooltips = [
         ("Cluster", " @cluster"),
         ("(RA, Dec)", " (@x, @y)"),
     ]

You could also just use custom tooltips (something like):

     hover.tooltips = """
  Cluster: @cluster <br />
  (RA, Dec): (@x, @y) <br />
     """

···

On 10/15/15 4:47 PM, [email protected] wrote:

I'm struggling to get a blank space after the colon in tooltips. My code
looks like:

    hover = p.select(dict(type=HoverTool))
    hover.tooltips = [
        ("Cluster", "@cluster"),
        ("(RA, Dec)", "(@x, @y)"),
        ("L [0.1-2.4 keV]", "(@lx \u00B1 @lx_err) x 1E+44 erg/s"),
        ("P [1.4 GHz]", "(@pow \u00B1 @pow_err) x 1E+24 W/Hz"),
        ("YSZ", "(@y500 \u00B1 @y500_err) x 1E-04 Mpc\u2009\u00B2"),
    ]

which produces an output that looks like this:

<https://lh3.googleusercontent.com/-qIDLGLrHEoA/ViA3rnjT5bI/AAAAAAAAADQ/9-tJsLpZ4jk/s1600/colon_tooltips.png>

Instead, I would like the text to appear as:

Cluster: MACS J0717.5+3745

(RA, Dec): (07:17:33.8, +37:45:20)

and so on.

The strange thing is that I've used Bokeh for another figure, and there
the space was automatically added after the colon. The tooltips for the
two figures are very similar.

A workaround I've found is to add some space in unicode, e.g., \u2003
(the normal space, \u0020, doesn't work). But I don't understand why the
space automatically appears in some plots and not in others.

--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/bc0c12a0-fc54-4cbc-ad30-211d8b914388%40continuum.io
<https://groups.google.com/a/continuum.io/d/msgid/bokeh/bc0c12a0-fc54-4cbc-ad30-211d8b914388%40continuum.io?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.