Skip to content

Scales

bqscales.Scale

Bases: Widget

The base scale class.

Scale objects represent a mapping between data (the domain) and a visual quantity (The range).

ATTRIBUTE DESCRIPTION
scale_types

A registry of existing scale types.

TYPE: dict (class-level attribute)

domain_class

traitlet type used to validate values in of the domain of the scale.

TYPE: type (default: Float)

reverse

whether the scale should be reversed.

TYPE: bool (default: False)

allow_padding

indicates whether figures are allowed to add data padding to this scale or not.

TYPE: bool (default: True)

precedence

attribute used to determine which scale takes precedence in cases when two or more scales have the same rtype and dtype.

TYPE: int (class-level attribute)

bqscales.LinearScale

Bases: Scale

A linear scale.

An affine mapping from a numerical domain to a numerical range.

ATTRIBUTE DESCRIPTION
min

if not None, min is the minimal value of the domain

TYPE: float or None (default: None)

max

if not None, max is the maximal value of the domain

TYPE: float or None (default: None)

rtype

This attribute should not be modified. The range type of a linear scale is numerical.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

precedence

attribute used to determine which scale takes precedence in cases when two or more scales have the same rtype and dtype. default_value is 2 because for the same range and domain types, LinearScale should take precedence.

TYPE: int (class-level attribute, default_value=2)

stabilized

if set to False, the domain of the scale is tied to the data range if set to True, the domain of the scale is updated only when the data range is beyond certain thresholds, given by the attributes mid_range and min_range.

TYPE: bool (default: False)

mid_range

Proportion of the range that is spanned initially. Used only if stabilized is True.

TYPE: float (default: 0.8)

min_range

Minimum proportion of the range that should be spanned by the data. If the data span falls beneath that level, the scale is reset. min_range must be <= mid_range. Used only if stabilized is True.

TYPE: float (default: 0.6)

bqscales.LogScale

Bases: Scale

A log scale.

A logarithmic mapping from a numerical domain to a numerical range.

ATTRIBUTE DESCRIPTION
min

if not None, min is the minimal value of the domain

TYPE: float or None (default: None)

max

if not None, max is the maximal value of the domain

TYPE: float or None (default: None)

rtype

This attribute should not be modified by the user. The range type of a linear scale is numerical.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.DateScale

Bases: Scale

A date scale, with customizable formatting.

An affine mapping from dates to a numerical range.

ATTRIBUTE DESCRIPTION
min

if not None, min is the minimal value of the domain

TYPE: Date or None (default: None)

max

if not None, max is the maximal value of the domain

TYPE: Date (default: None)

domain_class

traitlet type used to validate values in of the domain of the scale.

TYPE: type (default: Date)

rtype

This attribute should not be modified by the user. The range type of a linear scale is numerical.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.OrdinalScale

Bases: Scale

An ordinal scale.

A mapping from a discrete set of values to a numerical range.

ATTRIBUTE DESCRIPTION
domain

The discrete values mapped by the ordinal scale

TYPE: list (default: [])

rtype

This attribute should not be modified by the user. The range type of a linear scale is numerical.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.ColorScale

Bases: Scale

A color scale.

A mapping from numbers to colors. The relation is affine by part.

ATTRIBUTE DESCRIPTION
scale_type

scale type

TYPE: {linear}

colors

list of colors

TYPE: list of colors (default: [])

min

if not None, min is the minimal value of the domain

TYPE: float or None (default: None)

max

if not None, max is the maximal value of the domain

TYPE: float or None (default: None)

mid

if not None, mid is the value corresponding to the mid color.

TYPE: float or None (default: None)

scheme

Colorbrewer color scheme of the color scale.

TYPE: string (default: 'RdYlGn')

extrapolation

How to extrapolate values outside the [min, max] domain.

TYPE: {'constant', 'linear'} (default: 'constant')

rtype

The range type of a color scale is 'Color'. This should not be modified.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.DateColorScale

Bases: ColorScale

A date color scale.

A mapping from dates to a numerical domain.

ATTRIBUTE DESCRIPTION
min

if not None, min is the minimal value of the domain

TYPE: Date or None (default: None)

max

if not None, max is the maximal value of the domain

TYPE: Date or None (default: None)

mid

if not None, mid is the value corresponding to the mid color.

TYPE: Date or None (default: None)

rtype

This attribute should not be modified by the user. The range type of a color scale is 'Color'.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.OrdinalColorScale

Bases: ColorScale

An ordinal color scale.

A mapping from a discrete set of values to colors.

ATTRIBUTE DESCRIPTION
domain

The discrete values mapped by the ordinal scales.

TYPE: list (default: [])

rtype

This attribute should not be modified by the user. The range type of a color scale is 'color'.

TYPE: string (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.GeoScale

Bases: Scale

The base projection scale class for Map marks.

The GeoScale represents a mapping between topographic data and a 2d visual representation.

bqscales.Orthographic

Bases: GeoScale

A perspective projection that depicts a hemisphere as it appears from outer space.

The projection is neither equal-area nor conformal.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 145)

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))

rotate

Degree of rotation in each axis.

TYPE: tuple (default: (96, 0))

clip_angle

Specifies the clipping circle radius to the specified angle in degrees.

TYPE: float (default: 90.)

precision

Specifies the threshold for the projections adaptive resampling to the specified value in pixels.

TYPE: float (default: 0.1)

bqscales.Mercator

Bases: GeoScale

A geographical projection scale commonly used for world maps.

The Mercator projection is a cylindrical map projection which ensures that any course of constant bearing is a straight line.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 190)

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))

rotate

Degree of rotation in each axis.

TYPE: tuple (default: (0, 0))

rtype

This attribute should not be modified. The range type of a geo scale is a tuple.

TYPE: (Number, Number) (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.Albers

Bases: GeoScale

A geographical scale which is an alias for a conic equal area projection.

The Albers projection is a conic equal area map. It does not preserve scale or shape, though it is recommended for chloropleths since it preserves the relative areas of geographic features. Default values are US-centric.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 250)

rotate

Degree of rotation in each axis.

TYPE: tuple (default: (96, 0))

parallels

Sets the two parallels for the conic projection.

TYPE: tuple (default: (29.5, 45.5))

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))

precision

Specifies the threshold for the projections adaptive resampling to the specified value in pixels.

TYPE: float (default: 0.1)

rtype

This attribute should not be modified. The range type of a geo scale is a tuple.

TYPE: (Number, Number) (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.AlbersUSA

Bases: GeoScale

A composite projection of four Albers projections meant specifically for the United States.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 1200)

translate

TYPE: tuple (default: (600, 490))

rtype

This attribute should not be modified. The range type of a geo scale is a tuple.

TYPE: (Number, Number) (class-level attribute)

dtype

the associated data type / domain type

TYPE: type (class-level attribute)

bqscales.Gnomonic

Bases: GeoScale

A perspective projection which displays great circles as straight lines.

The projection is neither equal-area nor conformal.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 145)

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))

precision

Specifies the threshold for the projections adaptive resampling to the specified value in pixels.

TYPE: float (default: 0.1)

clip_angle

Specifies the clipping circle radius to the specified angle in degrees.

TYPE: float (default: 89.999)

bqscales.Stereographic

Bases: GeoScale

A perspective projection that uses a bijective and smooth map at every point except the projection point.

The projection is not an equal-area projection but it is conformal.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 250)

rotate

Degree of rotation in each axis.

TYPE: tuple (default: (96, 0))

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))

precision

Specifies the threshold for the projections adaptive resampling to the specified value in pixels.

TYPE: float (default: 0.1)

clip_angle

Specifies the clipping circle radius to the specified angle in degrees.

TYPE: float (default: 90.)

bqscales.EquiRectangular

Bases: GeoScale

An elementary projection that uses the identity function.

The projection is neither equal-area nor conformal.

ATTRIBUTE DESCRIPTION
scale_factor

Specifies the scale value for the projection

TYPE: float (default: 145)

center

Specifies the longitude and latitude where the map is centered.

TYPE: tuple (default: (0, 60))