Skip to content

Constants Module

datachart.constants

Module containing the constants.

The constants module provides a set of predefined constants used in the package. These include figure size, format, style, and other figure manipulation values.

CLASS DESCRIPTION
FIG_SIZE

The predefined figure sizes.

FIG_FORMAT

The supported figure formats.

FONT_STYLE

The supported font styles.

FONT_WEIGHT

The supported font weights.

LINE_MARKER

The supported line markers.

LINE_STYLE

The supported line styles.

LINE_DRAW_STYLE

The supported line draw styles.

HATCH_STYLE

The supported hatch styles.

LEGEND_ALIGN

The supported legend alignments.

LEGEND_LOCATION

The supported legend locations.

HISTOGRAM_TYPE

The supported histogram types.

COLORS

The predefined colors.

NORMALIZE

The supported normalization options.

ORIENTATION

The supported orientations.

VALFMT

The predefined value formats.

THEME

The predefined themes.

SHOW_GRID

The supported show grid options.

SCALE

The supported scale options.

ASPECT_RATIO

The supported aspect ratio options.

COLORBAR_LOCATION

The supported colorbar locations.

FIG_SIZE

The predefined figure sizes.

Examples:

>>> from datachart.constants import FIG_SIZE
>>> FIG_SIZE.DEFAULT
(6.4, 4.8)
ATTRIBUTE DESCRIPTION
DEFAULT

The default figure size. Equals to (6.4, 4.8).

TYPE: Tuple[float, float]

A4_PORTRAIT

The A4 portrait figure size. Equals to (8.2, 11.6).

TYPE: Tuple[float, float]

A4

Alias for A4_PORTRAIT. Deprecated, use A4_PORTRAIT instead.

TYPE: Tuple[float, float]

A4_LANDSCAPE

The A4 landscape figure size. Equals to (11.6, 8.2).

TYPE: Tuple[float, float]

A4_NARROW

The flat, full-width A4 figure size. Equals to (8.2, 2.4).

TYPE: Tuple[float, float]

A4_REGULAR

The regular, full-width A4 figure size. Equals to (8.2, 4.8).

TYPE: Tuple[float, float]

A4_WIDE

The tall, full-width A4 figure size. Equals to (8.2, 7.2).

TYPE: Tuple[float, float]

A4_HALF_PORTRAIT

The A4 half-width portrait figure size. Equals to (4.1, 5.8).

TYPE: Tuple[float, float]

A4_HALF_LANDSCAPE

The A4 half-width landscape figure size. Equals to (5.8, 4.1).

TYPE: Tuple[float, float]

A4_HALF_NARROW

The flat, half-width A4 figure size. Equals to (4.1, 2.4).

TYPE: Tuple[float, float]

A4_HALF_REGULAR

The regular, half-width A4 figure size. Equals to (4.1, 4.8).

TYPE: Tuple[float, float]

A4_HALF_WIDE

The tall, half-width A4 figure size. Equals to (4.1, 7.2).

TYPE: Tuple[float, float]

LETTER_PORTRAIT

The US Letter portrait figure size. Equals to (8.5, 11.0).

TYPE: Tuple[float, float]

LETTER_LANDSCAPE

The US Letter landscape figure size. Equals to (11.0, 8.5).

TYPE: Tuple[float, float]

LETTER_NARROW

The flat, full-width Letter figure size. Equals to (8.5, 2.4).

TYPE: Tuple[float, float]

LETTER_REGULAR

The regular, full-width Letter figure size. Equals to (8.5, 4.8).

TYPE: Tuple[float, float]

LETTER_WIDE

The tall, full-width Letter figure size. Equals to (8.5, 7.2).

TYPE: Tuple[float, float]

TALL_NARROW

The moderately tall, narrow figure size. Equals to (4.1, 6.0).

TYPE: Tuple[float, float]

TALL_REGULAR

The regular tall, narrow figure size. Equals to (4.1, 8.0).

TYPE: Tuple[float, float]

TALL_WIDE

The very tall, narrow figure size. Equals to (4.1, 11.6).

TYPE: Tuple[float, float]

SQUARE

The regular square figure size. Equals to (6.4, 6.4).

TYPE: Tuple[float, float]

SQUARE_SMALL

The small square figure size. Equals to (4.8, 4.8).

TYPE: Tuple[float, float]

SQUARE_LARGE

The large square figure size. Equals to (8.2, 8.2).

TYPE: Tuple[float, float]

FIG_FORMAT

The supported figure formats.

Examples:

>>> from datachart.constants import FIG_FORMAT
>>> FIG_FORMAT.DEFAULT
"png"
ATTRIBUTE DESCRIPTION
DEFAULT

The default format. Same as FIG_FORMAT.PNG.

TYPE: str

SVG

The svg format. Equals to "svg".

TYPE: str

PDF

The pdf format. Equals to "pdf".

TYPE: str

PNG

The png format. Equals to "png".

TYPE: str

WEBP

The webp format. Equals to "webp".

TYPE: str

EPS

The eps format (Encapsulated PostScript). Equals to "eps".

TYPE: str

JPG

The jpg format. Equals to "jpg".

TYPE: str

TIFF

The tiff format. Equals to "tiff".

TYPE: str

FONT_STYLE

The supported font styles.

Examples:

>>> from datachart.constants import FONT_STYLE
>>> FONT_STYLE.DEFAULT
"normal"
ATTRIBUTE DESCRIPTION
DEFAULT

The default font style. Same as FONT_STYLE.NORMAL.

TYPE: str

NORMAL

The normal font style. Equals to "normal".

TYPE: str

ITALIC

The italic font style. Equals to "italic".

TYPE: str

OBLIQUE

The oblique font style. Equals to "oblique".

TYPE: str

FONT_WEIGHT

The supported font weights.

Examples:

>>> from datachart.constants import FONT_WEIGHT
>>> FONT_WEIGHT.DEFAULT
"normal"
ATTRIBUTE DESCRIPTION
DEFAULT

The default font weight. Same as FONT_WEIGHT.NORMAL.

TYPE: str

ULTRA_LIGHT

The ultra light font weight. Equals to "ultralight".

TYPE: str

LIGHT

The light font weight. Equals to "light".

TYPE: str

NORMAL

The normal font weight. Equals to "normal".

TYPE: str

MEDIUM

The medium font weight. Equals to "medium".

TYPE: str

SEMIBOLD

The semibold font weight. Equals to "semibold".

TYPE: str

DEMI_BOLD

The demibold font weight. Equals to "demibold".

TYPE: str

BOLD

The bold font weight. Equals to "bold".

TYPE: str

EXTRA_BOLD

The extra bold font weight. Equals to "extra bold".

TYPE: str

HEAVY

The heavy font weight. Equals to "heavy".

TYPE: str

ULTRA_HEAVY

The ultra heavy font weight. Equals to "ultrabold".

TYPE: str

BLACK

The black font weight. Equals to "black".

TYPE: str

LINE_MARKER

The supported line markers.

Examples:

>>> from datachart.constants import LINE_MARKER
>>> LINE_MARKER.PIXEL
","
ATTRIBUTE DESCRIPTION
NONE

No marker. Equals to "".

TYPE: str

PIXEL

The pixel line marker. Equals to ",".

TYPE: str

POINT

The point line marker. Equals to ".".

TYPE: str

CIRCLE

The circle line marker. Equals to "o".

TYPE: str

DIAMOND

The diamond line marker. Equals to "D".

TYPE: str

THIN_DIAMOND

The thin diamond line marker. Equals to "d".

TYPE: str

TRIANGLE

The triangle (up) line marker. Equals to "^".

TYPE: str

TRIANGLE_DOWN

The triangle down line marker. Equals to "v".

TYPE: str

TRIANGLE_LEFT

The triangle left line marker. Equals to "<".

TYPE: str

TRIANGLE_RIGHT

The triangle right line marker. Equals to ">".

TYPE: str

SQUARE

The square line marker. Equals to "s".

TYPE: str

PENTAGON

The pentagon line marker. Equals to "p".

TYPE: str

HEXAGON

The hexagon line marker. Equals to "h".

TYPE: str

STAR

The star line marker. Equals to "*".

TYPE: str

CROSS

The cross line marker. Equals to "x".

TYPE: str

PLUS

The plus line marker. Equals to "+".

TYPE: str

VLINE

The vertical line marker. Equals to "|".

TYPE: str

HLINE

The horizontal line marker. Equals to "_".

TYPE: str

LINE_STYLE

The supported line styles.

Examples:

>>> from datachart.constants import LINE_STYLE
>>> LINE_STYLE.SOLID
"-"
ATTRIBUTE DESCRIPTION
NONE

No line style. Equals to "".

TYPE: str

SOLID

The solid line style. Equals to "-".

TYPE: str

DASHED

The dashed line style. Equals to "--".

TYPE: str

DASHDOT

The dashdot line style. Equals to "-.".

TYPE: str

DOTTED

The dotted line style. Equals to ":".

TYPE: str

LINE_DRAW_STYLE

The supported line draw styles.

Examples:

>>> from datachart.constants import LINE_DRAW_STYLE
>>> LINE_DRAW_STYLE.DEFAULT
"default"
ATTRIBUTE DESCRIPTION
DEFAULT

The default line draw style. Equals to "default".

TYPE: str

STEPS

The steps line draw style. Equals to "steps-pre".

TYPE: str

STEPS_PRE

The pre-steps line draw style. Equals to "steps-pre".

TYPE: str

STEPS_MID

The mid-steps line draw style. Equals to "steps-mid".

TYPE: str

STEPS_POST

The post-steps line draw style. Equals to "steps-post".

TYPE: str

HATCH_STYLE

The supported hatch styles.

Examples:

>>> from datachart.constants import HATCH_STYLE
>>> HATCH_STYLE.DEFAULT
None
ATTRIBUTE DESCRIPTION
DEFAULT

The default hatch style. Equals to None.

TYPE: str

DIAGONAL

The diagonal hatch style. Equals to "/".

TYPE: str

BACK_DIAGONAL

The back diagonal hatch style. Equals to "\\".

TYPE: str

VERTICAL

The vertical hatch style. Equals to "|".

TYPE: str

HORIZONTAL

The horizontal hatch style. Equals to "-".

TYPE: str

CROSSED

The crossed hatch style. Equals to "+".

TYPE: str

CROSSED_DIAGONAL

The crossed diagonal hatch style. Equals to "x".

TYPE: str

DOTS

The dots hatch style. Equals to ".".

TYPE: str

CIRCLES

The circles hatch style. Equals to "o".

TYPE: str

STARS

The stars hatch style. Equals to "*".

TYPE: str

LEGEND_ALIGN

The supported legend alignments.

Examples:

>>> from datachart.constants import LEGEND_ALIGN
>>> LEGEND_ALIGN.DEFAULT
"left"
ATTRIBUTE DESCRIPTION
DEFAULT

The default legend alignment. Same as LEGEND_ALIGN.LEFT.

TYPE: str

CENTER

The center legend alignment. Equals to "center".

TYPE: str

RIGHT

The right legend alignment. Equals to "right".

TYPE: str

LEFT

The left legend alignment. Equals to "left".

TYPE: str

LEGEND_LOCATION

The supported legend locations.

Examples:

>>> from datachart.constants import LEGEND_LOCATION
>>> LEGEND_LOCATION.BEST
"best"
ATTRIBUTE DESCRIPTION
BEST

Automatic best location. Equals to "best".

TYPE: str

UPPER_RIGHT

Upper right corner. Equals to "upper right".

TYPE: str

UPPER_LEFT

Upper left corner. Equals to "upper left".

TYPE: str

LOWER_LEFT

Lower left corner. Equals to "lower left".

TYPE: str

LOWER_RIGHT

Lower right corner. Equals to "lower right".

TYPE: str

RIGHT

Center right. Equals to "right".

TYPE: str

CENTER_LEFT

Center left. Equals to "center left".

TYPE: str

CENTER_RIGHT

Center right. Equals to "center right".

TYPE: str

LOWER_CENTER

Lower center. Equals to "lower center".

TYPE: str

UPPER_CENTER

Upper center. Equals to "upper center".

TYPE: str

CENTER

Center. Equals to "center".

TYPE: str

HISTOGRAM_TYPE

The supported histogram types.

Examples:

>>> from datachart.constants import HISTOGRAM_TYPE
>>> HISTOGRAM_TYPE.BAR
"bar"
ATTRIBUTE DESCRIPTION
BAR

The bar histogram style. Equals to "bar".

TYPE: str

BAR_STACKED

The stacked bar histogram style. Equals to "barstacked".

TYPE: str

STEP

The step histogram style. Equals to "step".

TYPE: str

STEPFILLED

The stepfilled histogram style. Equals to "stepfilled".

TYPE: str

COLORS

The predefined colors using pypalettes (https://y-sunflower.github.io/pypalettes/).

All palette names are valid pypalettes identifiers. You can use any of the 2500+ palettes available in pypalettes by passing the palette name as a string.

Examples:

>>> from datachart.constants import COLORS
>>> COLORS.Blues
'Blues'
ATTRIBUTE DESCRIPTION
Blues

Sequential blue palette. Equals to "Blues".

TYPE: str

Greens

Sequential green palette. Equals to "Greens".

TYPE: str

Oranges

Sequential orange palette. Equals to "Oranges".

TYPE: str

Purples

Sequential purple palette. Equals to "Purples".

TYPE: str

Reds

Sequential red palette. Equals to "Reds".

TYPE: str

Sunset2

Multi-hue sunset palette. Equals to "Sunset2".

TYPE: str

YlGnBu

Multi-hue yellow-green-blue palette. Equals to "YlGnBu".

TYPE: str

YlOrRd

Multi-hue yellow-orange-red palette. Equals to "YlOrRd".

TYPE: str

PuBuGn

Multi-hue purple-blue-green palette. Equals to "PuBuGn".

TYPE: str

RdBu

Diverging red-blue palette. Equals to "RdBu".

TYPE: str

BrBG

Diverging brown-blue-green palette. Equals to "BrBG".

TYPE: str

PuOr

Diverging purple-orange palette. Equals to "PuOr".

TYPE: str

Spectral

Diverging spectral palette. Equals to "Spectral".

TYPE: str

RdYlBu

Diverging red-yellow-blue palette. Equals to "RdYlBu".

TYPE: str

RdYlGn

Diverging red-yellow-green palette. Equals to "RdYlGn".

TYPE: str

Pastel

Soft pastel categorical palette. Equals to "Pastel".

TYPE: str

Set2

ColorBrewer Set2 categorical palette. Equals to "Set2".

TYPE: str

Accent

ColorBrewer Accent categorical palette. Equals to "Accent".

TYPE: str

Dark2

ColorBrewer Dark2 categorical palette. Equals to "Dark2".

TYPE: str

Paired

ColorBrewer Paired categorical palette (high contrast). Equals to "Paired".

TYPE: str

Set1

ColorBrewer Set1 categorical palette (high contrast). Equals to "Set1".

TYPE: str

Greys

Grayscale palette for monochrome visualizations. Equals to "Greys".

TYPE: str

Viridis

Perceptually uniform, color-blind friendly. Equals to "Viridis".

TYPE: str

Cividis

Color-blind friendly (optimized for CVD). Equals to "Cividis".

TYPE: str

Inferno

Perceptually uniform, color-blind friendly. Equals to "Inferno".

TYPE: str

Plasma

Perceptually uniform, color-blind friendly. Equals to "Plasma".

TYPE: str

Magma

Perceptually uniform, color-blind friendly. Equals to "Magma".

TYPE: str

Turbo

Rainbow-like but perceptually better. Equals to "Turbo".

TYPE: str

Coolwarm

Diverging cool-warm palette. Equals to "coolwarm".

TYPE: str

Tab10

Tableau 10-color categorical palette. Equals to "tab10".

TYPE: str

Tab20

Tableau 20-color categorical palette. Equals to "tab20".

TYPE: str

NORMALIZE

The supported normalization options.

Examples:

>>> from datachart.constants import NORMALIZE
>>> NORMALIZE.LINEAR
"linear"
ATTRIBUTE DESCRIPTION
LINEAR

The linear normalization. Equals to "linear".

TYPE: str

LOG

The logistic normalization. Equals to "log".

TYPE: str

SYMLOG

The symlog normalization. Equals to "symlog".

TYPE: str

ASINH

The asinh normalization. Equals to "asinh".

TYPE: str

LOGIT

The logit normalization. Equals to "logit".

TYPE: str

ORIENTATION

The supported orientations.

Examples:

>>> from datachart.constants import ORIENTATION
>>> ORIENTATION.HORIZONTAL
"horizontal"
ATTRIBUTE DESCRIPTION
HORIZONTAL

The horizontal orientation. Equals to "horizontal".

TYPE: str

VERTICAL

The vertical orientation. Equals to "vertical".

TYPE: str

VALFMT

The predefined value formats.

Examples:

>>> from datachart.constants import VALFMT
>>> VALFMT.DEFAULT
"{x}"
ATTRIBUTE DESCRIPTION
DEFAULT

The default value format. Equals to "{x}".

TYPE: str

INTEGER

The integer value format. Equals to "{x:d}".

TYPE: str

DECIMAL

The decimal value format (1 decimal place). Equals to "{x:.1f}".

TYPE: str

DECIMAL_2

The decimal value format (2 decimal places). Equals to "{x:.2f}".

TYPE: str

DECIMAL_3

The decimal value format (3 decimal places). Equals to "{x:.3f}".

TYPE: str

PERCENT

The percentage value format (1 decimal place). Equals to "{x:.1%}".

TYPE: str

PERCENT_INT

The percentage value format (no decimals). Equals to "{x:.0%}".

TYPE: str

SCIENTIFIC

The scientific notation format. Equals to "{x:.2e}".

TYPE: str

THOUSANDS

The thousands separator format. Equals to "{x:,.0f}".

TYPE: str

THEME

The predefined themes.

Examples:

>>> from datachart.constants import THEME
>>> THEME.DEFAULT
"default"
ATTRIBUTE DESCRIPTION
DEFAULT

The default theme. Equals to "default".

TYPE: str

GREYSCALE

The greyscale theme. Equals to "greyscale".

TYPE: str

PUBLICATION

The publication theme. Equals to "publication".

TYPE: str

BACKGROUND

The background theme (light gray for de-emphasized elements). Equals to "background".

TYPE: str

SHOW_GRID

The supported show grid options.

Examples:

>>> from datachart.constants import SHOW_GRID
>>> SHOW_GRID.DEFAULT
None
ATTRIBUTE DESCRIPTION
DEFAULT

The default show grid. Same as SHOW_GRID.NONE.

TYPE: str

NONE

Do not show the grid. Equals to None.

TYPE: None

X

Show the x-axis grid. Equals to "x".

TYPE: str

Y

Show the y-axis grid. Equals to "y".

TYPE: str

BOTH

Show both the x- and y-axis grid. Equals to "both".

TYPE: str

SCALE

The supported scale options.

Examples:

>>> from datachart.constants import SCALE
>>> SCALE.DEFAULT
"linear"
ATTRIBUTE DESCRIPTION
DEFAULT

The default scale. Same as SCALE.LINEAR.

TYPE: str

LINEAR

The linear scale. Equals to "linear".

TYPE: str

LOG

The log scale. Equals to "log".

TYPE: str

SYMLOG

The symlog scale. Equals to "symlog".

TYPE: str

ASINH

The asinh scale. Equals to "asinh".

TYPE: str

ASPECT_RATIO

The supported aspect ratio options.

Examples:

>>> from datachart.constants import ASPECT_RATIO
>>> ASPECT_RATIO.DEFAULT
"auto"
ATTRIBUTE DESCRIPTION
DEFAULT

The default aspect ratio. Same as ASPECT_RATIO.AUTO.

TYPE: str

AUTO

Automatic aspect ratio. Equals to "auto".

TYPE: str

EQUAL

Equal aspect ratio (1:1). Equals to "equal".

TYPE: str

COLORBAR_LOCATION

The supported colorbar locations.

Examples:

>>> from datachart.constants import COLORBAR_LOCATION
>>> COLORBAR_LOCATION.RIGHT
"right"
ATTRIBUTE DESCRIPTION
RIGHT

Right side of the chart. Equals to "right".

TYPE: str

LEFT

Left side of the chart. Equals to "left".

TYPE: str

TOP

Top of the chart. Equals to "top".

TYPE: str

BOTTOM

Bottom of the chart. Equals to "bottom".

TYPE: str