Changing properties of non-selected glyphs

Hi all,

As of Bokeh 0.8.1, is there a recommended way to set the properties of non-selected glyphs on say, a plot generated with circle()? I’d like to hack both the size of these glyphs (make the much smaller) and the color to differentiate them from the selected ones.

Thanks!

Hi,

···

On Fri, Feb 27, 2015 at 11:30 PM, Daniel Rothenberg [email protected] wrote:

Hi all,

As of Bokeh 0.8.1, is there a recommended way to set the properties of non-selected glyphs on say, a plot generated with circle()? I’d like to hack both the size of these glyphs (make the much smaller) and the color to differentiate them from the selected ones.

In [1]: from bokeh.plotting import *

In [2]: from bokeh.models import GlyphRenderer

In [3]: fig = figure()

In [4]: fig.circle([1,2,3], [1,2,3], radius=1.0)
Out[4]: <bokeh.plotting.Figure at 0x7f41d6385dd0>

In [5]: fig.select(dict(type=GlyphRenderer))[0]
Out[5]: <bokeh.models.renderers.GlyphRenderer at 0x7f41d9884e50>

In [6]: _5.nonselection_glyph.fill_color = ‘red’

In [7]: _5.nonselection_glyph.radius = 0.1

The non-obvious part is [5], because fig.circle() returns the figure itself, not the newly created glyph renderer. Perhaps even better would be to use fig.renderers[-1], because fig.circle() simply adds new glyph renderer to fig.renderers. I’m not sure why fig.circle() doesn’t return the glyph renderer (maybe others could explain that).

Mateusz

Thanks!

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/ed8d2492-526c-4a42-be55-699f2a629815%40continuum.io.

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

As it is, things like

figure().circle().quad()

would work. I don’t really have a strong opinion on whether that is useful or important. Having it return the glyph renderer seems like it could be more useful.

Bryan

···

On Sunday, March 1, 2015 at 5:18:06 PM UTC-6, mateusz.paprocki wrote:

Hi,

On Fri, Feb 27, 2015 at 11:30 PM, Daniel Rothenberg [email protected] wrote:

Hi all,

As of Bokeh 0.8.1, is there a recommended way to set the properties of non-selected glyphs on say, a plot generated with circle()? I’d like to hack both the size of these glyphs (make the much smaller) and the color to differentiate them from the selected ones.

In [1]: from bokeh.plotting import *

In [2]: from bokeh.models import GlyphRenderer

In [3]: fig = figure()

In [4]: fig.circle([1,2,3], [1,2,3], radius=1.0)
Out[4]: <bokeh.plotting.Figure at 0x7f41d6385dd0>

In [5]: fig.select(dict(type=GlyphRenderer))[0]
Out[5]: <bokeh.models.renderers.GlyphRenderer at 0x7f41d9884e50>

In [6]: _5.nonselection_glyph.fill_color = ‘red’

In [7]: _5.nonselection_glyph.radius = 0.1

The non-obvious part is [5], because fig.circle() returns the figure itself, not the newly created glyph renderer. Perhaps even better would be to use fig.renderers[-1], because fig.circle() simply adds new glyph renderer to fig.renderers. I’m not sure why fig.circle() doesn’t return the glyph renderer (maybe others could explain that).

Mateusz

Thanks!

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/ed8d2492-526c-4a42-be55-699f2a629815%40continuum.io.

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