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": "68abc44a-9c77-43e3-b030-cc0c1a301fbc",
  "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": "584b439e-87e3-4b5d-a478-cc3d7983efef",
  "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": "28566578-1f98-41f8-9ad0-55a8d49828a8",
  "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": "2f4d9a7e-cff9-44e7-9fb8-6ec3879a78e7",
  "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": "4c60b99a-efdb-40a3-8932-1c7e5ff92a25",
  "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": "ae7720db-045a-4d1a-a2fc-6eaf2530b4b5",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 0,
  "subscribed_events": [],
  "tags": [],
  "tickers": [
    {
      "id": "f5d569fd-208f-4bf7-8e6a-9a62f544a3d5",
      "type": "AdaptiveTicker"
    },
    {
      "id": "6cc9b4aa-e8dd-498a-b1e2-e58bf0a39f07",
      "type": "AdaptiveTicker"
    },
    {
      "id": "5afc21f1-2033-4bb2-b4ad-e29c0734a7ba",
      "type": "AdaptiveTicker"
    },
    {
      "id": "4d93db4a-c1d7-4548-b83d-4b2256f675f4",
      "type": "DaysTicker"
    },
    {
      "id": "436d813f-5e33-4f87-8cf7-36c1cd74a5cf",
      "type": "DaysTicker"
    },
    {
      "id": "8a95e1c4-5dbf-49d6-9923-d85d65d38d75",
      "type": "DaysTicker"
    },
    {
      "id": "5243b13c-aa37-47ec-8af2-30b4c254dedd",
      "type": "DaysTicker"
    },
    {
      "id": "d81aa83c-a787-4c1a-aebb-2200503641c0",
      "type": "MonthsTicker"
    },
    {
      "id": "3a9dcdae-08f1-4078-88d5-f98e9652b652",
      "type": "MonthsTicker"
    },
    {
      "id": "5c686d3f-baa5-43d2-9d21-322944808ce5",
      "type": "MonthsTicker"
    },
    {
      "id": "55095e6c-8d28-47c5-b819-95bff5f3f76d",
      "type": "MonthsTicker"
    },
    {
      "id": "7752dbdb-3a57-442f-894e-298d384d40d9",
      "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": "c569c8d1-a7c2-4519-afa3-69129d53c2e3",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 0,
  "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": "7856d3e3-7a9a-4ce7-b2f6-c2a7d4ca084d",
  "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": "53bb1b9d-2aec-490c-8879-ab54a6b9ae23",
  "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": "4b149555-43c3-4983-8ea7-13c8b0554f77",
  "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": "0ee985f8-6c3a-4e21-83ab-4e7f26fadf1f",
  "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": "59583f8c-c202-401d-996a-b408affa5969",
  "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": "e9cb18ed-bda2-4b2a-8fd6-9ff4410a2a32",
  "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": "327ecc93-dea6-4210-9027-2e8f4be4669f",
  "interval": null,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "num_minor_ticks": 5,
  "subscribed_events": [],
  "tags": []
}