☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

How to limit the number of minor lines in Grid

Community Supportbokehjs
_jm
_jm

@msiawa

The axes and (optionally grids) have tickers described here in the documentation.https://docs.bokeh.org/en/latest/docs/reference/models/tickers.html#bokeh.models.tickers.Ticker

Some of the tickers use the num_minor_ticks property, which sets the number of minor ticks between major ticks.

Here’s a small illustrative example customizing the minor ticks for the x-axis.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import numpy as np

from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource

x = np.linspace(0.0,1.0,1001)
y = np.sin(2.0*np.pi*x)

data = dict(x=x, y=y)

p = figure(width=500, height=500)

p.xaxis.ticker.num_minor_ticks = 2

p.xgrid.minor_grid_line_color = p.xgrid.grid_line_color
p.xgrid.minor_grid_line_dash = 'dotted'

ln = p.line(x='x', y='y', source=ColumnDataSource(data=data))


show(p)
⌁   Link to post

End of archived discussion · Replies are disabled