bokeh.models.tickers

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

class AdaptiveTicker(**kwargs)[source]

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: Float

The multiplier to use for scaling mantissas.

mantissas

property type: Seq ( Float )

The acceptable list numbers to generate multiples of.

max_interval

property type: Float

The largest allowable interval between two adjacent ticks.

Note

To specify an unbounded interval, set to None.

min_interval

property type: Float

The smallest allowable interval between two adjacent ticks.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "id": "0c3f9a06-edd7-4df6-88f3-c13a267e4b69",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "mantissas": [
    1,
    2,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class BasicTicker(**kwargs)[source]

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": "a42b0218-856c-49cc-8e97-e6724499b61a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "mantissas": [
    1,
    2,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class CategoricalTicker(**kwargs)[source]

Bases: bokeh.models.tickers.Ticker

Generate ticks for categorical ranges.

JSON Prototype
{
  "id": "fea7548e-2c98-4c99-b893-de1b1753a8f6",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class CompositeTicker(**kwargs)[source]

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: 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": "785d8356-5a37-4313-92ec-f317372fba2a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": [],
  "tickers": []
}
class ContinuousTicker(**kwargs)[source]

Bases: bokeh.models.tickers.Ticker

A base class for non-categorical ticker types.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

desired_num_ticks

property type: Int

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

num_minor_ticks

property type: Int

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

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "45fd243a-1976-47cc-b71d-a73ae6dd83a7",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class DatetimeTicker(**kwargs)[source]

Bases: bokeh.models.tickers.CompositeTicker

Generate nice ticks across different date and time scales.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "ff3c04d4-68c0-49e4-8e48-53a97f7264f9",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 0,
  "subscribed_events": [],
  "tags": [],
  "tickers": [
    {
      "id": "9e2f4f56-c9ac-4dd8-aa14-35f243b3a4bb",
      "type": "AdaptiveTicker"
    },
    {
      "id": "9250c273-58a3-4258-99d2-9410888d220c",
      "type": "AdaptiveTicker"
    },
    {
      "id": "d6b7836e-21fd-4d1c-9e41-9f4b92c35973",
      "type": "AdaptiveTicker"
    },
    {
      "id": "d3ff8298-d187-49f6-8535-384433c9d658",
      "type": "DaysTicker"
    },
    {
      "id": "8113cb45-4b99-4efa-9b25-8134d4bc5f38",
      "type": "DaysTicker"
    },
    {
      "id": "947199d8-19fe-4441-a84d-61e080ac581a",
      "type": "DaysTicker"
    },
    {
      "id": "b740255a-68c8-4da0-beaf-d2cde5759ad0",
      "type": "DaysTicker"
    },
    {
      "id": "113c67e0-22b1-4716-9f6a-5ecec7588dd8",
      "type": "MonthsTicker"
    },
    {
      "id": "c310bdfd-a939-466a-9f24-7bbec73f32bc",
      "type": "MonthsTicker"
    },
    {
      "id": "017f9551-0d06-4272-a392-0375595f7786",
      "type": "MonthsTicker"
    },
    {
      "id": "48630d7c-346e-4f03-9479-286de7b75d46",
      "type": "MonthsTicker"
    },
    {
      "id": "88ab0035-e72c-4c5c-b678-0d3ec1d106e9",
      "type": "YearsTicker"
    }
  ]
}
class DaysTicker(**kwargs)[source]

Bases: bokeh.models.tickers.SingleIntervalTicker

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

days

property type: Seq ( Int )

The intervals of days to use.

JSON Prototype
{
  "days": [],
  "desired_num_ticks": 6,
  "id": "99b41fb8-01f9-4cb7-b68b-1800a912101f",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class FixedTicker(**kwargs)[source]

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: Seq ( Float )

List of tick locations.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "4e0cbd07-4ca5-44a4-a45a-6bb8770423fd",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": [],
  "ticks": []
}
class LogTicker(**kwargs)[source]

Bases: bokeh.models.tickers.AdaptiveTicker

Generate ticks on a log scale.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "id": "92fc292b-b87d-47df-8ea9-97bd30ca266d",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "mantissas": [
    1,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class MercatorTicker(**kwargs)[source]

Bases: bokeh.models.tickers.BasicTicker

Generate nice lat/lon ticks form underlying WebMercator coordinates.

dimension

property type: Enum ( LatLon )

Specify whether to generate ticks for Latitude or Longitude.

Projected coordinates are not separable, computing Latitude and Longitude tick locations from Web Mercator requires considering coordinates from both dimensions together. Use this property to specify which result should be returned.

Typically, if the ticker is for an x-axis, then dimension should be "lon" and if the ticker is for a y-axis, then the dimension should be “lat”`.

In order to prevent hard to debug errors, there is no default value for dimension. Using an un-configured MercatorTicker will result in a validation error and a JavaScript console error.

JSON Prototype
{
  "base": 10.0,
  "desired_num_ticks": 6,
  "dimension": null,
  "id": "9403e445-2045-4586-b74a-0c39c145eb35",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "mantissas": [
    1,
    2,
    5
  ],
  "max_interval": null,
  "min_interval": 0.0,
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class MonthsTicker(**kwargs)[source]

Bases: bokeh.models.tickers.SingleIntervalTicker

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

months

property type: Seq ( Int )

The intervals of months to use.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "cbed8e96-1807-4755-b885-92d6b0fa7736",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "months": [],
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class SingleIntervalTicker(**kwargs)[source]

Bases: bokeh.models.tickers.ContinuousTicker

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

interval

property type: Float

The interval between adjacent ticks.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "8f3b3e89-0714-4f63-bc5f-5ccd8736fc91",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}
class Ticker(**kwargs)[source]

Bases: bokeh.model.Model

A base class for all ticker types.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

JSON Prototype
{
  "id": "431e93b9-32c8-4207-901b-147157110756",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class YearsTicker(**kwargs)[source]

Bases: bokeh.models.tickers.SingleIntervalTicker

Generate ticks spaced apart even numbers of years.

JSON Prototype
{
  "desired_num_ticks": 6,
  "id": "9640aa12-ec43-4e75-abb3-cf2cc03cb447",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}