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": "c10230fe-220d-4aad-bc52-f9fad6295d57",
  "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": "e3498bf3-a541-4215-8c82-76cc2db9d8c3",
  "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": "ab2d5314-ef47-43d7-b75b-fac2aecb1084",
  "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": "c54299f0-dc08-4051-9503-95321674e7ae",
  "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": "4c4a86f7-33e5-4d1d-8a87-8c3ff18ac1a6",
  "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": "687703b3-fc8a-41b2-adb8-64c85919208b",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 0,
  "subscribed_events": [],
  "tags": [],
  "tickers": [
    {
      "id": "d3d42b5c-9177-44a7-b62d-0e81a6ef464c",
      "type": "AdaptiveTicker"
    },
    {
      "id": "33ce99dc-3d23-4414-96ee-1a369018febb",
      "type": "AdaptiveTicker"
    },
    {
      "id": "94fe04ef-7e23-439d-922b-bba929f19c33",
      "type": "AdaptiveTicker"
    },
    {
      "id": "f0e50080-d8c6-4c1e-997a-685d49eac248",
      "type": "DaysTicker"
    },
    {
      "id": "95d72e04-a450-4282-8daf-2c2f2b845329",
      "type": "DaysTicker"
    },
    {
      "id": "aa11361c-8aa9-4b48-9197-6aa32c897917",
      "type": "DaysTicker"
    },
    {
      "id": "03a96122-8886-4953-9656-28030d40e004",
      "type": "DaysTicker"
    },
    {
      "id": "56d6cfdb-5ca9-469c-82f5-a423be84385f",
      "type": "MonthsTicker"
    },
    {
      "id": "2390670d-efb3-4c56-bbfb-298e85170840",
      "type": "MonthsTicker"
    },
    {
      "id": "8711c5de-683a-404f-af04-7a6fcd4c19c4",
      "type": "MonthsTicker"
    },
    {
      "id": "868ecb2b-39eb-4238-a266-2bbf2505b56e",
      "type": "MonthsTicker"
    },
    {
      "id": "e65bb4f8-7545-47ad-bb4d-09bb64603847",
      "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": "0d5edf26-0463-4003-a77e-5a60c75d3c17",
  "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": "6ce12bae-0cd1-4767-8693-af528c8fd029",
  "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": "5f1dab43-9769-4312-9445-7fdc60a1f2ce",
  "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": "ac713108-06f7-4586-96d2-35c44ead9f25",
  "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": "46d93c60-73dc-47ce-96b1-0968b44d5237",
  "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": "58b45147-abeb-4e0a-b8c9-ed639c0eb266",
  "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": "ed1ac65e-6d76-4344-abcc-d495e80cc786",
  "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": "f35d5168-107b-459b-bba4-13ae9ec0f274",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}