On Jun 12, 2018, at 08:33, Angelo Fausti <[email protected]> wrote:

Hi Bryan,

wanted to share this technote that features the Bokeh Models API and the "additive development" approach

https://sqr-022.lsst.io/v/DM-14731/index.html

thanks,

Angelo Fausti

On Thu, Jun 7, 2018 at 1:58 PM, Angelo Fausti <[email protected]> wrote:

Thanks Brian,

it makes sense now. I have to initialize the FactorRange with the possible factors first, which may not necessarily be the values in the ColumnDataSource.

plot = Plot(x_range=DataRange1d(), y_range=FactorRange(factors=['A', 'B', 'C']), y_scale=CategoricalScale())

source = ColumnDataSource({'labels': ['A', 'B', 'C'],

'values': [8.0, 11.0, 22.0],

'stretch': [5, 5, 10],

'design': [10, 10, 15],

'minimum': [20, 20, 30]})

hbar = HBar(y='labels', left='stretch', right='minimum', height=0.5)

plot.add_glyph(source, hbar)

xaxis = LinearAxis()

plot.add_layout(xaxis, 'below')

show(plot)

Angelo Fausti

On Thu, Jun 7, 2018 at 1:35 PM, Bryan Van de ven <[email protected]> wrote:

Hi,

Your FactorRange appears to be unconfigured. It has a "factors" property that needs to list all the categorical factors in the desired order for the axis.

Thanks,

Bryan

> On Jun 7, 2018, at 13:29, Angelo Fausti <[email protected]> wrote:

>

> Inspired by this post (https://bokeh.github.io/blog/2017/7/5/idiomatic_bokeh/) I am trying to compose glyphs to create a new chart.

>

> I can add a HBar using linear scale in both x and y axis but I need the y axis to be categorical.

>

> What I am doing wrong?

>

> from bokeh.io import curdoc, show, output_notebook

> from bokeh.models import Plot, ColumnDataSource, DataRange1d, FactorRange, LinearAxis

> from bokeh.models.scales import CategoricalScale

> from bokeh.models.glyphs import HBar

> output_notebook()

>

> plot = Plot(x_range=DataRange1d(), y_range=FactorRange(), y_scale=CategoricalScale())

>

> source = ColumnDataSource({'labels': ['A', 'B', 'C'],

> 'minimum': [5, 5, 10],

> 'maximum': [20, 20, 30]})

>

> hbar = HBar(y='labels', left='minimum', right='maximum', height=0.5)

> plot.add_glyph(source, hbar)

>

> xaxis = LinearAxis()

> plot.add_layout(xaxis, 'below')

>

> show(plot)

>

> thanks,

> Angelo Fausti

>

>

> --

> 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/CAD%3DOK5NygU4EVN-Jx-pHewmaTezUS%3DOO55se%3DieUXoigZccy7Q%40mail.gmail.com.

> 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/3DE00562-A8D8-46FC-82E1-8F5545336CA5%40anaconda.com.

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/CAD%3DOK5OTqOQs-HTEh6%2BT7ZEctE8RSoMa-CobaWGOsiqpfFiYZw%40mail.gmail.com.

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