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": "caa56ded-a315-4e2f-a737-4a5aab2faecc",
  "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": "5dd8d84e-1bcd-4dc6-9eed-08426ca97b75",
  "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": "4b301acd-82ea-4f36-a272-b2f9a6d0766a",
  "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": "d8d07173-4e56-426c-a4f9-379026413b06",
  "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": "147169a9-368c-4ec2-a11e-2f0223772ead",
  "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": "916d4422-08bf-4a2b-a5b8-df0cc520f7c0",
  "name": null,
  "num_minor_ticks": 0,
  "tags": [],
  "tickers": [
    {
      "id": "acf54c64-f637-477a-bdb3-995493419c64",
      "type": "AdaptiveTicker"
    },
    {
      "id": "f487131b-e849-41cd-bb73-c69fd334963c",
      "type": "AdaptiveTicker"
    },
    {
      "id": "b752e320-d03b-4fe5-bc10-37d5824384c7",
      "type": "AdaptiveTicker"
    },
    {
      "id": "755c2d43-ade8-414b-867c-9d63cbc5038b",
      "type": "DaysTicker"
    },
    {
      "id": "4dea6ef1-0c2f-41b4-b2f8-764930d3f17a",
      "type": "DaysTicker"
    },
    {
      "id": "b18db620-0c72-4aaa-b9a1-d2aeecac3923",
      "type": "DaysTicker"
    },
    {
      "id": "a2198480-e3a2-483b-b668-6b20a077af5e",
      "type": "DaysTicker"
    },
    {
      "id": "cbc7c426-da09-4b7d-8063-9c78ac1d3a1a",
      "type": "MonthsTicker"
    },
    {
      "id": "33740cd5-0bd1-43ec-b717-895a870ebaae",
      "type": "MonthsTicker"
    },
    {
      "id": "b72006db-8545-4b88-bc59-70e656790356",
      "type": "MonthsTicker"
    },
    {
      "id": "45f01655-b89d-4d38-a246-71251acdb791",
      "type": "MonthsTicker"
    },
    {
      "id": "bce267c8-4785-4b5e-ab1b-400dfb6238aa",
      "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": "374d6c9b-cd2f-416e-b8b5-206c3b7db0c0",
  "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": "0c435c93-9554-4254-9b56-c9ad43fdda4e",
  "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": "2e80e1fe-a873-4aeb-9e78-93f182bd6c4d",
  "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": "31aee404-1d72-4b78-b0cc-9ab7938ebad7",
  "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": "7cb99c87-5c87-4964-b4a5-5b264fcc3c4a",
  "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": "6489afdf-9877-41a1-8320-b55482053ad6",
  "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": "71da988f-3377-4d3a-8e9b-38c67a4c4b09",
  "interval": null,
  "name": null,
  "num_minor_ticks": 5,
  "tags": []
}