bokeh.models.tickers

Models for computing good tick locations on different kinds of plots.

class AdaptiveTicker(**kwargs)

Bases: bokeh.models.tickers.ContinuousTicker

Generate “nice” round ticks at any magnitude.

Creates ticks that are “base” multiples of a set of given mantissas. For example, with base=10 and mantissas=[1, 2, 5], the ticker will generate the sequence:

..., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, ...
base

property type: base:Float

The multiplier to use for scaling mantissas.

mantissas

property type: mantissas:Seq(Float)

The acceptable list numbers to generate multiples of.

max_interval

property type: max_interval:Float

The largest allowable interval between two adjacent ticks.

Note

To specify an unbounded interval, set to None.

min_interval

property type: min_interval:Float

The smallest allowable interval between two adjacent ticks.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "id": "4cc7d33d-2e64-4ea4-a08d-089931f079bc",
  "mantissas": [
    1,
    2,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class BasicTicker(**kwargs)

Bases: bokeh.models.tickers.AdaptiveTicker

Generate ticks on a linear scale.

Note

This class may be renamed to LinearTicker in the future.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "id": "4128ffb5-14bd-4d1a-b92b-511a1ed89d27",
  "mantissas": [
    1,
    2,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class CategoricalTicker(**kwargs)

Bases: bokeh.models.tickers.Ticker

Generate ticks for categorical ranges.

JSON Prototype
{
  "id": "a7930b86-e6ef-4801-a5de-196a7f528785",
  "name": null,
  "tags": []
}
class CompositeTicker(**kwargs)

Bases: bokeh.models.tickers.ContinuousTicker

Combine different tickers at different scales.

Uses the min_interval and max_interval interval attributes of the tickers to select the appropriate ticker at different scales.

tickers

property type: tickers:Seq(Instance(Ticker))

A list of Ticker objects to combine at different scales in order to generate tick values. The supplied tickers should be in order. Specifically, if S comes before T, then it should be the case that:

S.get_max_interval() < T.get_min_interval()
JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "b291f31c-065d-4d5b-be92-8087eacfc94f",
  "name": null,
  "num_minor_ticks": 5,
  "tags": [],
  "tickers": []
}
class ContinuousTicker(**kwargs)

Bases: bokeh.models.tickers.Ticker

A base class for non-categorical ticker types. ContinuousTicker is not generally useful to instantiate on its own.

desired_num_ticks

property type: desired_num_ticks:Int

A desired target number of major tick positions to generate across the plot range.

num_minor_ticks

property type: num_minor_ticks:Int

The number of minor tick positions to generate between adjacent major tick values.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "edd6dbfd-8bc6-4f37-a715-de43ec6d9cc1",
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class DatetimeTicker(**kwargs)

Bases: bokeh.models.tickers.CompositeTicker

Generate nice ticks across different date and time scales.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "f22b60e2-4eec-4316-b187-b0df4859f727",
  "name": null,
  "num_minor_ticks": 0,
  "tags": [],
  "tickers": [
    {
      "id": "2dcedef5-c2e6-47be-bac6-74febbb75ec1",
      "type": "AdaptiveTicker"
    },
    {
      "id": "5322622b-a56a-4006-81dc-12cc88a01f89",
      "type": "AdaptiveTicker"
    },
    {
      "id": "25cefc48-d4a7-4f7e-b6a0-22ff258aeb57",
      "type": "AdaptiveTicker"
    },
    {
      "id": "f0999747-7dae-4dfb-bbba-94c5ee9d205e",
      "type": "DaysTicker"
    },
    {
      "id": "c9c28014-ea41-4907-a55b-0e9a104a5c48",
      "type": "DaysTicker"
    },
    {
      "id": "1122d2d8-5383-466b-b021-ddebb3969419",
      "type": "DaysTicker"
    },
    {
      "id": "1937f355-1553-48a4-aa76-52f0e93493f2",
      "type": "DaysTicker"
    },
    {
      "id": "6da09205-c0d3-4d20-9aa6-e833aad78953",
      "type": "MonthsTicker"
    },
    {
      "id": "c0aa5328-6afa-46b6-be5c-3f57deec7074",
      "type": "MonthsTicker"
    },
    {
      "id": "183a43e5-e8d8-4b8d-b88d-eb21b05cd716",
      "type": "MonthsTicker"
    },
    {
      "id": "e8c5597a-fef4-4189-b3c6-be091d65d910",
      "type": "MonthsTicker"
    },
    {
      "id": "3b43ace8-0b2f-48b2-b0fc-497a8a6f6985",
      "type": "YearsTicker"
    }
  ]
}
class DaysTicker(**kwargs)

Bases: bokeh.models.tickers.SingleIntervalTicker

Generate ticks spaced apart by specific, even multiples of days.

days

property type: days:Seq(Int)

The intervals of days to use.

JSON Prototype
{
  "days": [],
  "desired_num_ticks": 6,
  "id": "fe515599-188f-47b5-b553-5528dcdf3c4c",
  "interval": null,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class FixedTicker(**kwargs)

Bases: bokeh.models.tickers.ContinuousTicker

Generate ticks at fixed, explicitly supplied locations.

Note

The desired_num_ticks property is ignored by this Ticker.

ticks

property type: ticks:Seq(Float)

List of tick locations.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "38ed5d57-090f-47e7-b204-5cd27ed1c090",
  "name": null,
  "num_minor_ticks": 5,
  "tags": [],
  "ticks": []
}
class LogTicker(**kwargs)

Bases: bokeh.models.tickers.AdaptiveTicker

Generate ticks on a log scale.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "id": "5a023db7-4829-4f14-bb5c-2c5cfc3a6bf8",
  "mantissas": [
    1,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class MonthsTicker(**kwargs)

Bases: bokeh.models.tickers.SingleIntervalTicker

Generate ticks spaced apart by specific, even multiples of months.

months

property type: months:Seq(Int)

The intervals of months to use.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "b2062883-59fb-43d2-8adf-cd253b1c0a72",
  "interval": null,
  "months": [],
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class SingleIntervalTicker(**kwargs)

Bases: bokeh.models.tickers.ContinuousTicker

Generate evenly spaced ticks at a fixed interval regardless of scale.

interval

property type: interval:Float

The interval between adjacent ticks.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "d0610cf2-ec79-45cf-9518-17795bc39df5",
  "interval": null,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}
class Ticker(**kwargs)

Bases: bokeh.model.Model

A base class for all ticker types. Ticker is not generally useful to instantiate on its own.

JSON Prototype
{
  "id": "ecf68454-fc3e-47c9-a2e4-fe7d367d98a5",
  "name": null,
  "tags": []
}
class YearsTicker(**kwargs)

Bases: bokeh.models.tickers.SingleIntervalTicker

Generate ticks spaced apart even numbers of years.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "13fbd094-20c7-430c-98cf-08229943a11c",
  "interval": null,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}