bokeh.models.axes

Guide renderers for various kinds of axes that can be added to Bokeh plots

class Axis(**kwargs)[source]

Bases: bokeh.models.renderers.GuideRenderer

A base class that defines common properties for all axis 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.

axis_label

property type: String

A text label for the axis, displayed parallel to the axis rule.

Note

LaTeX notation is not currently supported; please see #647 to track progress or contribute.

axis_label_standoff

property type: Int

The distance in pixels that the axis labels should be offset from the tick labels.

axis_label_text_align

property type: Enum ( TextAlign )

The text align of the axis label.

axis_label_text_alpha

property type: NumberSpec

The text alpha of the axis label.

axis_label_text_baseline

property type: Enum ( TextBaseline )

The text baseline of the axis label.

axis_label_text_color

property type: ColorSpec

The text color of the axis label.

axis_label_text_font

property type: String

The text font of the axis label.

axis_label_text_font_size

property type: FontSizeSpec

The text font size of the axis label.

axis_label_text_font_style

property type: Enum ( FontStyle )

The text font style of the axis label.

axis_line_alpha

property type: NumberSpec

The line alpha of the axis line.

axis_line_cap

property type: Enum ( LineCap )

The line cap of the axis line.

axis_line_color

property type: ColorSpec

The line color of the axis line.

axis_line_dash

property type: DashPattern

The line dash of the axis line.

axis_line_dash_offset

property type: Int

The line dash offset of the axis line.

axis_line_join

property type: Enum ( LineJoin )

The line join of the axis line.

axis_line_width

property type: NumberSpec

The line width of the axis line.

bounds

property type: Either ( Auto , Tuple ( Float , Float ), Tuple ( Datetime , Datetime ) )

Bounds for the rendered axis. If unset, the axis will span the entire plot in the given dimension.

formatter

property type: Instance ( TickFormatter )

A TickFormatter to use for formatting the visual appearance of ticks.

major_label_orientation

property type: Either ( Enum ( Enumeration(horizontal, vertical) ), Float )

What direction the major label text should be oriented. If a number is supplied, the angle of the text is measured from horizontal.

major_label_overrides

property type: Dict ( Either ( Float , String ), String )

Provide explicit tick label values for specific tick locations that override normal formatting.

major_label_standoff

property type: Int

The distance in pixels that the major tick labels should be offset from the associated ticks.

major_label_text_align

property type: Enum ( TextAlign )

The text align of the major tick labels.

major_label_text_alpha

property type: NumberSpec

The text alpha of the major tick labels.

major_label_text_baseline

property type: Enum ( TextBaseline )

The text baseline of the major tick labels.

major_label_text_color

property type: ColorSpec

The text color of the major tick labels.

major_label_text_font

property type: String

The text font of the major tick labels.

major_label_text_font_size

property type: FontSizeSpec

The text font size of the major tick labels.

major_label_text_font_style

property type: Enum ( FontStyle )

The text font style of the major tick labels.

major_tick_in

property type: Int

The distance in pixels that major ticks should extend into the main plot area.

major_tick_line_alpha

property type: NumberSpec

The line alpha of the major ticks.

major_tick_line_cap

property type: Enum ( LineCap )

The line cap of the major ticks.

major_tick_line_color

property type: ColorSpec

The line color of the major ticks.

major_tick_line_dash

property type: DashPattern

The line dash of the major ticks.

major_tick_line_dash_offset

property type: Int

The line dash offset of the major ticks.

major_tick_line_join

property type: Enum ( LineJoin )

The line join of the major ticks.

major_tick_line_width

property type: NumberSpec

The line width of the major ticks.

major_tick_out

property type: Int

The distance in pixels that major ticks should extend out of the main plot area.

minor_tick_in

property type: Int

The distance in pixels that minor ticks should extend into the main plot area.

minor_tick_line_alpha

property type: NumberSpec

The line alpha of the minor ticks.

minor_tick_line_cap

property type: Enum ( LineCap )

The line cap of the minor ticks.

minor_tick_line_color

property type: ColorSpec

The line color of the minor ticks.

minor_tick_line_dash

property type: DashPattern

The line dash of the minor ticks.

minor_tick_line_dash_offset

property type: Int

The line dash offset of the minor ticks.

minor_tick_line_join

property type: Enum ( LineJoin )

The line join of the minor ticks.

minor_tick_line_width

property type: NumberSpec

The line width of the minor ticks.

minor_tick_out

property type: Int

The distance in pixels that major ticks should extend out of the main plot area.

ticker

property type: Instance ( Ticker )

A Ticker to use for computing locations of axis components.

The property may also be passed a sequence of floating point numbers as a shorthand for creating and configuring a FixedTicker, e.g. the following code

from bokeh.plotting import figure

p = figure()
p.xaxis.ticker = [10, 20, 37.4]

is equivalent to:

from bokeh.plotting import figure
from bokeh.models.tickers import FixedTicker

p = figure()
p.xaxis.ticker = FixedTicker(ticks=[10, 20, 37.4])
x_range_name

property type: String

A particular (named) x-range to use for computing screen locations when rendering an axis on the plot. If unset, use the default x-range.

y_range_name

property type: String

A particular (named) y-range to use for computing screen locations when rendering an axis on the plot. If unset, use the default y-range.

JSON Prototype
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": null,
  "id": "bcc99444-b488-48d4-8943-bf335572c8c8",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": null,
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class CategoricalAxis(**kwargs)[source]

Bases: bokeh.models.axes.Axis

An axis that picks evenly spaced tick locations for a collection of categories/factors.

JSON Prototype
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": {
    "id": "4fa17e07-07a4-4f1d-be7e-d9cacbd5c364",
    "type": "CategoricalTickFormatter"
  },
  "id": "0dcb4da5-e35f-4b2f-9d23-14001b742040",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": {
    "id": "0e427bad-5fe1-4242-8bc9-50fb7b48305a",
    "type": "CategoricalTicker"
  },
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class ContinuousAxis(**kwargs)[source]

Bases: bokeh.models.axes.Axis

A base class for all numeric, non-categorical axes 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
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": null,
  "id": "a550c3ec-5dfd-4304-85f5-cc1e36d139e9",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": null,
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class DatetimeAxis(**kwargs)[source]

Bases: bokeh.models.axes.LinearAxis

An LinearAxis that picks nice numbers for tick locations on a datetime scale. Configured with a DatetimeTickFormatter by default.

JSON Prototype
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": {
    "id": "94599208-ef5e-4934-be2a-b7792a52667f",
    "type": "DatetimeTickFormatter"
  },
  "id": "c11dc2fc-f65b-4b13-8d42-3f07f8ec2e2b",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": {
    "id": "64da628a-32fc-4554-b5e3-21cf33b492bd",
    "type": "DatetimeTicker"
  },
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class LinearAxis(**kwargs)[source]

Bases: bokeh.models.axes.ContinuousAxis

An axis that picks nice numbers for tick locations on a linear scale. Configured with a BasicTickFormatter by default.

JSON Prototype
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": {
    "id": "01a5990d-7ac1-4deb-93d5-b25449e80e66",
    "type": "BasicTickFormatter"
  },
  "id": "f3303b09-25ae-4392-a672-7f9beb7a704d",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": {
    "id": "265d9bf7-1331-4413-92d3-7db4cec2b0be",
    "type": "BasicTicker"
  },
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class LogAxis(**kwargs)[source]

Bases: bokeh.models.axes.ContinuousAxis

An axis that picks nice numbers for tick locations on a log scale. Configured with a LogTickFormatter by default.

JSON Prototype
{
  "axis_label": "",
  "axis_label_standoff": 5,
  "axis_label_text_align": "left",
  "axis_label_text_alpha": {
    "value": 1.0
  },
  "axis_label_text_baseline": "bottom",
  "axis_label_text_color": {
    "value": "#444444"
  },
  "axis_label_text_font": "helvetica",
  "axis_label_text_font_size": {
    "value": "10pt"
  },
  "axis_label_text_font_style": "italic",
  "axis_line_alpha": {
    "value": 1.0
  },
  "axis_line_cap": "butt",
  "axis_line_color": {
    "value": "black"
  },
  "axis_line_dash": [],
  "axis_line_dash_offset": 0,
  "axis_line_join": "miter",
  "axis_line_width": {
    "value": 1
  },
  "bounds": "auto",
  "formatter": {
    "id": "abdc3a10-a29c-445c-bfad-580fa167026b",
    "type": "LogTickFormatter"
  },
  "id": "a882eabd-9bf7-4ee2-bbfe-b9b9eaddd49d",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "major_label_orientation": "horizontal",
  "major_label_overrides": {},
  "major_label_standoff": 5,
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "alphabetic",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_tick_in": 2,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "black"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "miter",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 6,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": "black"
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "miter",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 4,
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "ticker": {
    "id": "bdb4ba47-fba8-4d47-95d4-2fbd4ff192c8",
    "type": "LogTicker"
  },
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}