twin y axis, adding grids

Using bokeh 0.12.1.

I have a chart with twin Y axis, one on each side of it.

g1 = figure(tools=tools, x_range=labels, y_range=Range1d(0,scale_a))
extra_axis = LinearAxis(y_range_name='extra_y')
g1.extra_y_ranges = {'extra_y': Range1d(0, scale_b)}
g1.add_layout(extra_axis, 'right')
[...glyphs added to g1...]

Having a named LinearAxis (extra_axis) allows me to use two different colors for the major labels corresponding to the glyph colors:

g1.yaxis.major_label_text_color = primary_color
extra_axis.major_label_text_color = secondary_color

I can similarly add horizontal grid lines on the major labels, color coded for the main yaxis (ygrid):

g1.ygrid.grid_line_alpha = 0.5
g1.ygrid.grid_line_color = primary_color

But I can’t figure out how to enable a secondary horizontal set of gridlines corresponding to the secondary y axis. Is there a secondary ygrid? Can’t seem to figure out the name.

Thanks,

Francois

Spitballing, I figured I’d need to manage the secondary grid, and tried:

extra_grid = Grid(ticker=extra_axis.ticker, dimension=1)
extra_grid.grid_line_color = secondary_color
extra_grid.grid_line_alpha = 0.5
g1.add_layout(extra_grid)

But no joy...
···

On Wednesday, September 7, 2016 at 5:13:15 PM UTC-4, Francois Dion wrote:

Using bokeh 0.12.1.


I have a chart with twin Y axis, one on each side of it.


g1 = figure(tools=tools, x_range=labels, y_range=Range1d(0,scale_a))
extra_axis = LinearAxis(y_range_name='extra_y')
g1.extra_y_ranges = {'extra_y': Range1d(0, scale_b)}
g1.add_layout(extra_axis, 'right')
[...glyphs added to g1...]


Having a named LinearAxis (extra_axis) allows me to use two different colors for the major labels corresponding to the glyph colors:

g1.yaxis.major_label_text_color = primary_color
extra_axis.major_label_text_color = secondary_color

I can similarly add horizontal grid lines on the major labels, color coded for the main yaxis (ygrid):

g1.ygrid.grid_line_alpha = 0.5
g1.ygrid.grid_line_color = primary_color

But I can’t figure out how to enable a secondary horizontal set of gridlines corresponding to the secondary y axis. Is there a secondary ygrid? Can’t seem to figure out the name.

Thanks,

Francois

Try setting the dimension property to 0 or 1 depending on direction

···

On Sep 7, 2016, at 19:39, Francois Dion [email protected] wrote:

Spitballing, I figured I’d need to manage the secondary grid, and tried:

extra_grid = Grid(ticker=extra_axis.ticker, dimension=1)
extra_grid.grid_line_color = secondary_color
extra_grid.grid_line_alpha = 0.5
g1.add_layout(extra_grid)


But no joy...

On Wednesday, September 7, 2016 at 5:13:15 PM UTC-4, Francois Dion wrote:

Using bokeh 0.12.1.


I have a chart with twin Y axis, one on each side of it.


g1 = figure(tools=tools, x_range=labels, y_range=Range1d(0,scale_a))
extra_axis = LinearAxis(y_range_name='extra_y')
g1.extra_y_ranges = {'extra_y': Range1d(0, scale_b)}
g1.add_layout(extra_axis, 'right')
[...glyphs added to g1...]


Having a named LinearAxis (extra_axis) allows me to use two different colors for the major labels corresponding to the glyph colors:

g1.yaxis.major_label_text_color = primary_color
extra_axis.major_label_text_color = secondary_color

I can similarly add horizontal grid lines on the major labels, color coded for the main yaxis (ygrid):

g1.ygrid.grid_line_alpha = 0.5
g1.ygrid.grid_line_color = primary_color

But I can’t figure out how to enable a secondary horizontal set of gridlines corresponding to the secondary y axis. Is there a secondary ygrid? Can’t seem to figure out the name.

Thanks,

Francois

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/5d12ed25-f86a-4ac5-979a-6b98e2589e4e%40continuum.io.

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