colour.plotting.common Module

Common Plotting

Defines the common plotting objects:

colour.plotting.common.PLOTTING_RESOURCES_DIRECTORY = '/colour-science/colour/colour/plotting/resources'

Resources directory.

RESOURCES_DIRECTORY : unicode

colour.plotting.common.DEFAULT_FIGURE_ASPECT_RATIO = 0.6180339887498949

Default figure aspect ratio (Golden Number).

DEFAULT_FIGURE_ASPECT_RATIO : float

colour.plotting.common.DEFAULT_FIGURE_WIDTH = 12

Default figure width.

DEFAULT_FIGURE_WIDTH : integer

colour.plotting.common.DEFAULT_FIGURE_HEIGHT = 7.4164078649987388

Default figure height.

DEFAULT_FIGURE_HEIGHT : integer

colour.plotting.common.DEFAULT_FIGURE_SIZE = (12, 7.4164078649987388)

Default figure size.

DEFAULT_FIGURE_SIZE : tuple

colour.plotting.common.DEFAULT_FONT_SIZE = 10

Default figure font size.

DEFAULT_FONT_SIZE : numeric

colour.plotting.common.DEFAULT_PARAMETERS = {'legend.fontsize': 9.0, 'axes.labelsize': 12.5, 'font.size': 10, 'figure.figsize': (12, 7.4164078649987388), 'ytick.labelsize': 10, 'xtick.labelsize': 10, 'axes.titlesize': 12.5}

Default plotting parameters.

DEFAULT_PARAMETERS : dict

class colour.plotting.common.ColourParameter

Bases: tuple

ColourParameter(name, RGB, x, y0, y1)

RGB

Alias for field number 1

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__getstate__()

Exclude the OrderedDict from pickling

__repr__()

Return a nicely formatted representation string

name

Alias for field number 0

x

Alias for field number 2

y0

Alias for field number 3

y1

Alias for field number 4

class colour.plotting.common.ColourParameter

Bases: tuple

ColourParameter(name, RGB, x, y0, y1)

RGB

Alias for field number 1

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__getstate__()

Exclude the OrderedDict from pickling

__repr__()

Return a nicely formatted representation string

name

Alias for field number 0

x

Alias for field number 2

y0

Alias for field number 3

y1

Alias for field number 4

colour.plotting.common.colour_cycle(**kwargs)[source]

Returns a colour cycle iterator using given colour map.

Keywords arguments.

Colour cycle iterator.

colour.plotting.common.canvas(**kwargs)[source]

Sets the figure size and aspect.

Parameters:**kwargs (**) – Keywords arguments.
Returns:Current figure.
Return type:Figure
colour.plotting.common.decorate(**kwargs)[source]

Sets the figure decorations.

Parameters:**kwargs (**) – Keywords arguments.
Returns:Definition success.
Return type:bool
colour.plotting.common.boundaries(**kwargs)[source]

Sets the plot boundaries.

Parameters:**kwargs (**) – Keywords arguments.
Returns:Definition success.
Return type:bool
colour.plotting.common.display(**kwargs)[source]

Sets the figure display.

Parameters:**kwargs (**) – Keywords arguments.
Returns:Definition success.
Return type:bool
colour.plotting.common.colour_parameter(name=None, RGB=None, x=None, y0=None, y1=None)[source]

Defines a factory for colour.plotting.plots.COLOUR_PARAMETER attribute.

Parameters:
  • name (unicode, optional) – Colour name.
  • RGB (array_like, optional) – RGB Colour.
  • x (numeric, optional) – X data.
  • y0 (numeric, optional) – Y0 data.
  • y1 (numeric, optional) – Y1 data.
Returns:

ColourParameter.

Return type:

ColourParameter

colour.plotting.common.colour_parameters_plot(colour_parameters, y0_plot=True, y1_plot=True, **kwargs)[source]

Plots given colour colour_parameters.

Parameters:
  • colour_parameters (list) – ColourParameter sequence.
  • y0_plot (bool, optional) – Plot y0 line.
  • y1_plot (bool, optional) – Plot y1 line.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> cp1 = colour_parameter(x=390, RGB=[0.03009021, 0, 0.12300545])
>>> cp2 = colour_parameter(x=391, RGB=[0.03434063, 0, 0.13328537], y0=0, y1=0.25)  
>>> cp3 = colour_parameter(x=392, RGB=[0.03826312, 0, 0.14276247], y0=0, y1=0.35)  
>>> cp4 = colour_parameter(x=393, RGB=[0.04191844, 0, 0.15158707], y0=0, y1=0.05)  
>>> cp5 = colour_parameter(x=394, RGB=[0.04535085, 0, 0.15986838], y0=0, y1=-.25)  
>>> colour_parameters_plot([cp1, cp2, cp3, cp3, cp4, cp5])    
True
colour.plotting.common.single_colour_plot(colour_parameter, **kwargs)[source]

Plots given colour.

Parameters:
  • colour_parameter (ColourParameter) – ColourParameter.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> RGB = (0.32315746, 0.32983556, 0.33640183)
>>> single_colour_plot(colour_parameter(RGB))  
True
colour.plotting.common.multi_colour_plot(colour_parameters, width=1, height=1, spacing=0, across=3, text_display=True, text_size='large', text_offset=0.075, **kwargs)[source]

Plots given colours.

Parameters:
  • colour_parameters (list) – ColourParameter sequence.
  • width (numeric, optional) – Colour polygon width.
  • height (numeric, optional) – Colour polygon height.
  • spacing (numeric, optional) – Colour polygons spacing.
  • across (int, optional) – Colour polygons count per row.
  • text_display (bool, optional) – Display colour text.
  • text_size (numeric, optional) – Colour text size.
  • text_offset (numeric, optional) – Colour text offset.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> cp1 = colour_parameter(RGB=(0.45293517, 0.31732158, 0.26414773))
>>> cp2 = colour_parameter(RGB=(0.77875824, 0.57726450, 0.50453169))
>>> multi_colour_plot([cp1, cp2])  
True
colour.plotting.common.image_plot(image, label=None, label_size=15, label_colour=None, label_alpha=0.85, **kwargs)[source]

Plots given image.

Parameters:
  • image (array_like) – Image to plot.
  • label (unicode, optional) – Image label.
  • label_size (int, optional) – Image label font size.
  • label_colour (array_like or unicode, optional) – Image label colour.
  • label_alpha (numeric, optional) – Image label alpha.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> import os
>>> from colour import read_image
>>> path = os.path.join('resources', 'CIE_1931_Chromaticity_Diagram_CIE_1931_2_Degree_Standard_Observer.png')  
>>> image = read_image(path)  
>>> image_plot(image)  
True