Is it possible to have two-tiered x-axis categorical labels?

I’m plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?

Similar to http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes

···

On Thursday, April 21, 2016 at 6:34:19 PM UTC+1, [email protected] wrote:

I’m plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?

That example linked shows a "twin axis" which Bokeh can do, and is demonstrated here:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py

I'm not sure if that is exactly what you are looking for from your description or not. There are plans to support nested coordinate systems (especially useful for categorical axes) and having single axes that can display nested coordinate systems much better. But that is future development.

Bryan

···

On Apr 21, 2016, at 12:43 PM, [email protected] wrote:

Similar to http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes

On Thursday, April 21, 2016 at 6:34:19 PM UTC+1, [email protected] wrote:
I'm plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?

--
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/9f612e11-27f6-40fe-8139-fd04eb93c1e8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Doesn’t quite work, but I have a hack:

Current bokeh python-side validation rules assume that any additional axis should be Range1d, but I want to add FactorRange instead using CategoricalAxis layout.

Bokeh 0.11.1 says:

ValueError: expected an element of Dict(String, Instance(Range1d)), got {'cat_x_axis': <bokeh.models.ranges.FactorRange object at ...

properties.py:1120


FactorRange works as expected when I comment out validation in line 1120. Where is the requirement that the axis element can only be Range1d?



···

On Thursday, April 21, 2016 at 8:45:58 PM UTC+1, Bryan Van de ven wrote:

That example linked shows a “twin axis” which Bokeh can do, and is demonstrated here:

    [https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py](https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py)

I’m not sure if that is exactly what you are looking for from your description or not. There are plans to support nested coordinate systems (especially useful for categorical axes) and having single axes that can display nested coordinate systems much better. But that is future development.

Bryan

On Apr 21, 2016, at 12:43 PM, [email protected] wrote:

Similar to http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes

On Thursday, April 21, 2016 at 6:34:19 PM UTC+1, [email protected] wrote:

I’m plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?


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/9f612e11-27f6-40fe-8139-fd04eb93c1e8%40continuum.io.

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

I think you have found a small bug. If you look at the actual property definitions, you see:

    extra_x_ranges = Dict(String, Instance(Range1d), help="""
    Additional named ranges to make available for mapping x-coordinates.
    This is useful for adding additional axes.
    """)

    extra_y_ranges = Dict(String, Instance(Range), help="""
    Additional named ranges to make available for mapping y-coordinates.
    This is useful for adding additional axes.
    """)

That x- and y- properties for extra ranges are different. There is definitely no reason for them to be different, so I am guessing this is just a typo or copy/paste error. Can you make a GH issue with this information? And then if you are able, could make a Pull Request to change the extra_x_ranges property to accept "Instance(Range)" just like extra_y_ranges? I'm in the middle of several other tasks, so it's a tremendous help when new people can take care of making PRs for things like this.

Thanks,

Bryan

···

On Apr 22, 2016, at 5:32 AM, [email protected] wrote:

Doesn't quite work, but I have a hack:

Current bokeh python-side validation rules assume that any additional axis should be Range1d, but I want to add FactorRange instead using CategoricalAxis layout.

Bokeh 0.11.1 says:
ValueError: expected an element of Dict(String, Instance(Range1d)), got {'cat_x_axis': <bokeh.models.ranges.FactorRange object at ...

properties.py:1120

FactorRange works as expected when I comment out validation in line 1120. Where is the requirement that the axis element can only be Range1d?

On Thursday, April 21, 2016 at 8:45:58 PM UTC+1, Bryan Van de ven wrote:
That example linked shows a "twin axis" which Bokeh can do, and is demonstrated here:

        https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py

I'm not sure if that is exactly what you are looking for from your description or not. There are plans to support nested coordinate systems (especially useful for categorical axes) and having single axes that can display nested coordinate systems much better. But that is future development.

Bryan

> On Apr 21, 2016, at 12:43 PM, [email protected] wrote:
>
> Similar to http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes
>
> On Thursday, April 21, 2016 at 6:34:19 PM UTC+1, [email protected] wrote:
> I'm plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?
>
> --
> 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/9f612e11-27f6-40fe-8139-fd04eb93c1e8%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/a97f12ff-c12e-45d7-9fdb-04e0350879d2%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Awesome, will create a pull request.

···

On Friday, April 22, 2016 at 3:24:15 PM UTC+1, Bryan Van de ven wrote:

I think you have found a small bug. If you look at the actual property definitions, you see:

extra_x_ranges = Dict(String, Instance(Range1d), help="""

Additional named ranges to make available for mapping x-coordinates.

This is useful for adding additional axes.

""")



extra_y_ranges = Dict(String, Instance(Range), help="""

Additional named ranges to make available for mapping y-coordinates.

This is useful for adding additional axes.

""")

That x- and y- properties for extra ranges are different. There is definitely no reason for them to be different, so I am guessing this is just a typo or copy/paste error. Can you make a GH issue with this information? And then if you are able, could make a Pull Request to change the extra_x_ranges property to accept “Instance(Range)” just like extra_y_ranges? I’m in the middle of several other tasks, so it’s a tremendous help when new people can take care of making PRs for things like this.

Thanks,

Bryan

On Apr 22, 2016, at 5:32 AM, [email protected] wrote:

Doesn’t quite work, but I have a hack:

Current bokeh python-side validation rules assume that any additional axis should be Range1d, but I want to add FactorRange instead using CategoricalAxis layout.

Bokeh 0.11.1 says:

ValueError: expected an element of Dict(String, Instance(Range1d)), got {‘cat_x_axis’: <bokeh.models.ranges.FactorRange object at …

properties.py:1120

FactorRange works as expected when I comment out validation in line 1120. Where is the requirement that the axis element can only be Range1d?

On Thursday, April 21, 2016 at 8:45:58 PM UTC+1, Bryan Van de ven wrote:

That example linked shows a “twin axis” which Bokeh can do, and is demonstrated here:

    [https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py](https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/twin_axis.py)

I’m not sure if that is exactly what you are looking for from your description or not. There are plans to support nested coordinate systems (especially useful for categorical axes) and having single axes that can display nested coordinate systems much better. But that is future development.

Bryan

On Apr 21, 2016, at 12:43 PM, [email protected] wrote:

Similar to http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes

On Thursday, April 21, 2016 at 6:34:19 PM UTC+1, [email protected] wrote:
I’m plotting measures against countries (CategoricalAxis). I would like to group countries into regions and below such a group add a label with the name of the region. Is it somehow possible, perhaps using minor/major xticklabels or simply using text?


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/9f612e11-27f6-40fe-8139-fd04eb93c1e8%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/a97f12ff-c12e-45d7-9fdb-04e0350879d2%40continuum.io.

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