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": "fbc7c9e3-ec97-40ef-82bb-4d9a4850469b",
  "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": "d3f3c556-858c-448e-974a-361008d264ac",
  "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": "a6ecc2a8-0770-4c11-987a-8a2d0fc1b950",
  "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": "0613b31e-2c83-4c15-b65f-6a301bf46409",
  "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": "d4e85f14-edcd-4a6a-9e53-b14e73deaa21",
  "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": "d2873542-c488-47e7-bde4-3768b8788ef5",
  "name": null,
  "num_minor_ticks": 0,
  "tags": [],
  "tickers": [
    {
      "id": "36246185-f8b8-4769-8ae6-7b2633bea9b3",
      "type": "AdaptiveTicker"
    },
    {
      "id": "8420e303-39c5-4663-a0fb-8f93aa50c24a",
      "type": "AdaptiveTicker"
    },
    {
      "id": "a3cda7fc-4ca0-4094-a0e5-7b39bab1076d",
      "type": "AdaptiveTicker"
    },
    {
      "id": "6852e997-ef70-457a-a477-4e31799d392a",
      "type": "DaysTicker"
    },
    {
      "id": "44e51909-35dd-48b1-bac6-2539a85fd006",
      "type": "DaysTicker"
    },
    {
      "id": "4853285d-58c3-4210-a37d-50222b0c34cb",
      "type": "DaysTicker"
    },
    {
      "id": "0764f7a8-5bfe-4bec-a210-b656a2efab2f",
      "type": "DaysTicker"
    },
    {
      "id": "70565952-f620-4d3c-9a27-5d89c3c5af11",
      "type": "MonthsTicker"
    },
    {
      "id": "cd62321b-07cb-410e-af91-cfde53e16841",
      "type": "MonthsTicker"
    },
    {
      "id": "7c43ff6c-19de-4ecc-abc6-4c4c612e197d",
      "type": "MonthsTicker"
    },
    {
      "id": "01baa8a0-0a3d-4752-81d4-01ce4c9bc737",
      "type": "MonthsTicker"
    },
    {
      "id": "b13ab52d-5a5f-47f2-85fc-9b9376abd3cd",
      "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": "23e4430f-3cb0-4174-9586-aa4c45450d85",
  "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": "eede88f7-f030-4190-8708-e8acb3f9bb44",
  "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": "4080942b-606c-484b-a3c5-9634b7b8acc1",
  "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": "ae0dd455-d148-474c-bbc6-10f28cd4a3db",
  "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": "6a3c6a59-c7a1-4ac5-9a6c-4369e8d4d635",
  "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": "cec41c30-7cb0-49ef-81c2-3e1bbf0cf7db",
  "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": "9ded03ed-fcb4-4392-86c1-1ad1378b6349",
  "interval": null,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}