How do I change the distance between the grid lines

Hi,

There seems to be a default behavior that will set the distance between the grids lines. How do I change that value so the grid lines appear closer or farther apart?

thanks,

Sharath.

Hi Sharath,

The grid line locations are determined by the Ticker object configured on the corresponding Axis. You can find the reference for all the built in tickers here:

  http://bokeh.pydata.org/en/latest/docs/reference/models/tickers.html

For the default tickers, you could increase the value of the `desired_num_ticks` property. This is only a hint to the ticker, however. If you want finer grained contril, you might have to use a different ticker than the default (e.g., Fixed, SingleInterval). You can see an example here:

  http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-locations
  
Thanks,

Bryan

···

On Dec 25, 2015, at 3:51 PM, Sharath <[email protected]> wrote:

Hi,

There seems to be a default behavior that will set the distance between the grids lines. How do I change that value so the grid lines appear closer or farther apart?

thanks,
Sharath.

--
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/45207490-fedc-4ab3-99a4-632df13484c8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

I appreciate you pointing this thread’s answer in the right direction.

Just want to add a more in-depth response & example, as I had to dig a bit deeper to get the expected outcome.

In order to change the spacing of the grid lines, you must adjust the ticker object for the grid class

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#lines

The documentation page you linked is the tick locations for the axis* class*.

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-locations

I would think most people would want to change BOTH the axis ticker location & the gridline ticker locations.

That is, the major xaxis tickers line up exactly with the grid line tickers.

Here is an example using a Fixed ticker:

p = Figure(plot_width=400, plot_height=400)

#change xaxis ticker & xgrid ticker with fixed-width spacing

p.xaxis[0].ticker=FixedTicker(ticks=np.arange(-15,200,5)) #spacing by 5 units from -15 to 200

p.xgrid[0].ticker=FixedTicker(ticks=np.arange(-15,200,5))

#change yaxis ticker & ygrid ticker with fixed-width spacing

p.yaxis[0].ticker=FixedTicker(ticks=np.arange(0,101,5)) #spacing by 5 units from 0 to 100

p.ygrid[0].ticker=FixedTicker(ticks=np.arange(0,101,5))

Bests,

···

On Monday, December 28, 2015 at 3:09:27 PM UTC-8, Bryan Van de ven wrote:

Hi Sharath,

The grid line locations are determined by the Ticker object configured on the corresponding Axis. You can find the reference for all the built in tickers here:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/tickers.html](http://www.google.com/url?q=http%3A%2F%2Fbokeh.pydata.org%2Fen%2Flatest%2Fdocs%2Freference%2Fmodels%2Ftickers.html&sa=D&sntz=1&usg=AFQjCNGM2JWpCc3mcHfuRGm68MOucXlINA)

For the default tickers, you could increase the value of the desired_num_ticks property. This is only a hint to the ticker, however. If you want finer grained contril, you might have to use a different ticker than the default (e.g., Fixed, SingleInterval). You can see an example here:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html#tick-locations](http://www.google.com/url?q=http%3A%2F%2Fbokeh.pydata.org%2Fen%2Flatest%2Fdocs%2Fuser_guide%2Fstyling.html%23tick-locations&sa=D&sntz=1&usg=AFQjCNFjDSgB_MrsTwGiOFRkSltNT-sZFQ)

Thanks,

Bryan

On Dec 25, 2015, at 3:51 PM, Sharath [email protected] wrote:

Hi,

There seems to be a default behavior that will set the distance between the grids lines. How do I change that value so the grid lines appear closer or farther apart?

thanks,

Sharath.


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/45207490-fedc-4ab3-99a4-632df13484c8%40continuum.io.

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