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": "93e0009a-090f-45b3-8fbe-dca90709b714",
  "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": "9f8d85cf-d84f-4c18-86aa-0d058bf01200",
  "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": "d7bc8638-8fae-455c-8bec-0163e86efd1a",
  "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": "da08d1bc-1ddc-43b9-8a41-7b711eca8a99",
  "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": "41b98f68-fc92-4d1a-a745-1ea1c01e17ad",
  "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": "9c296561-4553-4a43-9f99-4b16c4e6d412",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 0,
  "subscribed_events": [],
  "tags": [],
  "tickers": [
    {
      "id": "e8a8af5d-c38f-4931-ae5b-6e704ead1e9a",
      "type": "AdaptiveTicker"
    },
    {
      "id": "a929b72e-d4a5-4c50-898f-df623283bc45",
      "type": "AdaptiveTicker"
    },
    {
      "id": "62310527-a07f-4b82-894e-857ec6c0c8a1",
      "type": "AdaptiveTicker"
    },
    {
      "id": "ca7316ba-c78c-403d-8fde-0a0a1f74e2b7",
      "type": "DaysTicker"
    },
    {
      "id": "5833c02f-ca7c-4161-b7ee-c1dc8ef3cf39",
      "type": "DaysTicker"
    },
    {
      "id": "01f1d7c3-ea46-468c-a56b-c866d25f6a04",
      "type": "DaysTicker"
    },
    {
      "id": "392eec06-9bc3-47af-9aaf-cd40ae406587",
      "type": "DaysTicker"
    },
    {
      "id": "2a3961c8-a5ac-4d20-9eca-e3bdbdad0672",
      "type": "MonthsTicker"
    },
    {
      "id": "e2b293ad-52d6-4a7a-9317-b64a0ceef682",
      "type": "MonthsTicker"
    },
    {
      "id": "2e84420b-ae77-4306-857a-b062e157eb36",
      "type": "MonthsTicker"
    },
    {
      "id": "f40d970d-3b72-4bb6-889b-14319e6c1afe",
      "type": "MonthsTicker"
    },
    {
      "id": "90fd10ad-93d3-4490-81a9-ad7e181de8eb",
      "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": "0bc2a9bd-8269-41a2-afab-5c363e11d060",
  "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": "3bcba7bc-b003-4718-9c9f-65041bac2cdf",
  "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": "c7261de7-42ed-4c52-a4ad-08236f295e6f",
  "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": "d4b25891-7f96-4b9d-a0e4-408028140e95",
  "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": "70029ef3-c6be-43ef-b52d-868c41fa04a4",
  "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": "c94160b2-606f-4c83-a334-ceb1e114132f",
  "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": "f837c37b-672b-4967-a1f9-ba77ef4c8026",
  "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": "7cf88fc2-1cef-47eb-97f9-73151f7fedf7",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}