colour.plotting Package

Module Contents

colour.plotting.DEFAULT_PLOTTING_ENCODING_CCTF(L)

Defines the sRGB colourspace opto-electronic transfer function (OETF / OECF).

Parameters:L (numeric or array_like) – Luminance \(L\) of the image.
Returns:Corresponding electrical signal \(V\).
Return type:numeric or ndarray

Examples

>>> oetf_sRGB(0.18)  
0.4613561...
colour.plotting.colour_plotting_defaults(parameters=None)[source]

Enables Colour default plotting parameters.

Parameters:parameters (dict, optional) – Parameters to use for plotting.
Returns:Definition success.
Return type:bool
class colour.plotting.ColourParameter[source]

Bases: colour.plotting.common.ColourParameter

Defines a data structure for plotting a colour polygon in various spectral figures.

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 a new instance of the ColourParameter class.

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

Returns a colour cycle iterator using given colour map.

Other Parameters:
 
  • colour_cycle_map (unicode, optional) – Matplotlib colourmap name.
  • colour_cycle_count (int, optional) – Colours count to pick in the colourmap.
Returns:

Colour cycle iterator.

Return type:

cycle

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

Sets the figure size.

Other Parameters:
 figure_size (array_like, optional) – Array defining figure width and height such as figure_size = (width, height).
Returns:Current figure.
Return type:Figure
colour.plotting.camera(**kwargs)[source]

Sets the camera settings.

Other Parameters:
 
  • camera_aspect (unicode, optional) – Matplotlib axes aspect. Default is equal.
  • elevation (numeric, optional) – Camera elevation.
  • azimuth (numeric, optional) – Camera azimuth.
Returns:

Current axes.

Return type:

Axes

colour.plotting.decorate(**kwargs)[source]

Sets the figure decorations.

Other Parameters:
 
  • title (unicode, optional) – Figure title.
  • x_label (unicode, optional) – X axis label.
  • y_label (unicode, optional) – Y axis label.
  • legend (bool, optional) – Whether to display the legend. Default is False.
  • legend_columns (int, optional) – Number of columns in the legend. Default is 1.
  • legend_location (unicode, optional) – Matplotlib legend location. Default is upper right.
  • x_ticker (bool, optional) – Whether to display the X axis ticker. Default is True.
  • y_ticker (bool, optional) – Whether to display the Y axis ticker. Default is True.
  • x_ticker_locator (Locator, optional) – Locator type for the X axis ticker.
  • y_ticker_locator (Locator, optional) – Locator type for the Y axis ticker.
  • grid (bool, optional) – Whether to display the grid. Default is False.
  • grid_which (unicode, optional) – Controls whether major tick grids, minor tick grids, or both are affected. Default is both.
  • grid_axis (unicode, optional) – Controls which set of grid-lines are drawn. Default is both.
  • x_axis_line (bool, optional) – Whether to draw the X axis line. Default is False.
  • y_axis_line (bool, optional) – Whether to draw the Y axis line. Default is False.
  • aspect (unicode, optional) – Matplotlib axes aspect.
  • no_axes (bool, optional) – Whether to turn off the axes. Default is False.
Returns:

Current axes.

Return type:

Axes

colour.plotting.boundaries(**kwargs)[source]

Sets the plot boundaries.

Other Parameters:
 
  • bounding_box (array_like, optional) – Array defining current axes limits such bounding_box = (x min, x max, y min, y max).
  • x_tighten (bool, optional) – Whether to tighten the X axis limit. Default is False.
  • y_tighten (bool, optional) – Whether to tighten the Y axis limit. Default is False.
  • limits (array_like, optional) – Array defining current axes limits such as limits = (x limit min, x limit max, y limit min, y limit max). limits argument values are added to the margins argument values to define the final bounding box for the current axes.
  • margins (array_like, optional) – Array defining current axes margins such as margins = (x margin min, x margin max, y margin min, y margin max). margins argument values are added to the limits argument values to define the final bounding box for the current axes.
Returns:

Current axes.

Return type:

Axes

colour.plotting.display(**kwargs)[source]

Sets the figure display.

Other Parameters:
 
  • standalone (bool, optional) – Whether to show the figure.
  • filename (unicode, optional) – Figure will be saved using given filename argument.
Returns:

Current figure or None.

Return type:

Figure

colour.plotting.label_rectangles(rectangles, rotation='vertical', text_size=10, offset=None)[source]

Add labels above given rectangles.

Parameters:
  • rectangles (object) – Rectangles to used to set the labels value and position.
  • rotation (unicode, optional) – {‘horizontal’, ‘vertical’}, Labels orientation.
  • text_size (numeric, optional) – Labels text size.
  • offset (array_like, optional) – Labels offset as percentages of the largest rectangle dimensions.
Returns:

Definition success.

Return type:

bool

colour.plotting.equal_axes3d(axes)[source]

Sets equal aspect ratio to given 3d axes.

Parameters:axes (object) – Axis to set the equal aspect ratio.
Returns:Definition success.
Return type:bool
colour.plotting.get_RGB_colourspace(colourspace)[source]

Returns the RGB colourspace with given name.

Parameters:colourspace (unicode) – RGB colourspace name.
Returns:RGB colourspace.
Return type:RGB_Colourspace
Raises:KeyError – If the given RGB colourspace is not found in the factory RGB colourspaces.
colour.plotting.get_cmfs(cmfs)[source]

Returns the colour matching functions with given name.

Parameters:cmfs (unicode) – Colour matching functions name.
Returns:Colour matching functions.
Return type:RGB_ColourMatchingFunctions or XYZ_ColourMatchingFunctions
Raises:KeyError – If the given colour matching functions is not found in the factory colour matching functions.
colour.plotting.get_illuminant(illuminant)[source]

Returns the illuminant with given name.

Parameters:illuminant (unicode) – Illuminant name.
Returns:Illuminant.
Return type:SpectralPowerDistribution
Raises:KeyError – If the given illuminant is not found in the factory illuminants.
colour.plotting.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) – Whether to plot y0 line.
  • y1_plot (bool, optional) – Whether to plot y1 line.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

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

Plots given colour.

Parameters:

colour_parameter (ColourParameter) – ColourParameter.

Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> RGB = (0.32315746, 0.32983556, 0.33640183)
>>> single_colour_plot(ColourParameter(RGB))  
colour.plotting.multi_colour_plot(colour_parameters, width=1, height=1, spacing=0, across=3, text_display=True, text_size='large', text_offset=0.075, background_colour=(1.0, 1.0, 1.0), **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.
  • background_colour (array_like or unicode, optional) – Background colour.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> cp1 = ColourParameter(RGB=(0.45293517, 0.31732158, 0.26414773))
>>> cp2 = ColourParameter(RGB=(0.77875824, 0.57726450, 0.50453169))
>>> multi_colour_plot([cp1, cp2])  
colour.plotting.image_plot(image, label=None, label_size=15, label_colour=None, label_alpha=0.85, interpolation='nearest', colour_map=<Mock name='mock.cm.Greys_r' id='140395182810832'>, **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.
  • interpolation (unicode, optional) – {‘nearest’, None, ‘none’, ‘bilinear’, ‘bicubic’, ‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, ‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’, ‘mitchell’, ‘sinc’, ‘lanczos’} Image display interpolation.
  • colour_map (unicode, optional) – Colour map used to display single channel images.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

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)  
colour.plotting.single_spd_plot(spd, cmfs='CIE 1931 2 Degree Standard Observer', out_of_gamut_clipping=True, **kwargs)[source]

Plots given spectral power distribution.

Parameters:
  • spd (SpectralPowerDistribution) – Spectral power distribution to plot.
  • out_of_gamut_clipping (bool, optional) – Whether to clip out of gamut colours otherwise, the colours will be offset by the absolute minimal colour leading to a rendering on gray background, less saturated and smoother. [1]_
  • cmfs (unicode) – Standard observer colour matching functions used for spectrum creation.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import SpectralPowerDistribution
>>> data = {400: 0.0641, 420: 0.0645, 440: 0.0562}
>>> spd = SpectralPowerDistribution('Custom', data)
>>> single_spd_plot(spd)  
colour.plotting.multi_spd_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', use_spds_colours=False, normalise_spds_colours=False, **kwargs)[source]

Plots given spectral power distributions.

Parameters:
  • spds (list) – Spectral power distributions to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for spectrum creation.
  • use_spds_colours (bool, optional) – Whether to use spectral power distributions colours.
  • normalise_spds_colours (bool) – Whether to normalise spectral power distributions colours.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import SpectralPowerDistribution
>>> data1 = {400: 0.0641, 420: 0.0645, 440: 0.0562}
>>> data2 = {400: 0.134, 420: 0.789, 440: 1.289}
>>> spd1 = SpectralPowerDistribution('Custom1', data1)
>>> spd2 = SpectralPowerDistribution('Custom2', data2)
>>> multi_spd_plot([spd1, spd2])  
colour.plotting.single_cmfs_plot(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given colour matching functions.

Parameters:cmfs (unicode, optional) – Colour matching functions to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure

Examples

>>> single_cmfs_plot()  
colour.plotting.multi_cmfs_plot(cmfs=None, **kwargs)[source]

Plots given colour matching functions.

Parameters:cmfs (array_like, optional) – Colour matching functions to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure

Examples

>>> cmfs = [
... 'CIE 1931 2 Degree Standard Observer',
... 'CIE 1964 10 Degree Standard Observer']
>>> multi_cmfs_plot(cmfs)  
colour.plotting.single_illuminant_relative_spd_plot(illuminant='A', cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given single illuminant relative spectral power distribution.

Parameters:
  • illuminant (unicode, optional) – Factory illuminant to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions to plot.
Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • out_of_gamut_clipping (bool, optional) – {single_spd_plot()}, Whether to clip out of gamut colours otherwise, the colours will be offset by the absolute minimal colour leading to a rendering on gray background, less saturated and smoother. [1]_
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> single_illuminant_relative_spd_plot()  
colour.plotting.multi_illuminants_relative_spd_plot(illuminants=None, **kwargs)[source]

Plots given illuminants relative spectral power distributions.

Parameters:

illuminants (array_like, optional) – Factory illuminants to plot.

Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • use_spds_colours (bool, optional) – {multi_spd_plot()} Whether to use spectral power distributions colours.
  • normalise_spds_colours (bool) – {multi_spd_plot()} Whether to normalise spectral power distributions colours.
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> multi_illuminants_relative_spd_plot(['A', 'B', 'C'])  
colour.plotting.visible_spectrum_plot(cmfs='CIE 1931 2 Degree Standard Observer', out_of_gamut_clipping=True, **kwargs)[source]

Plots the visible colours spectrum using given standard observer CIE XYZ colour matching functions.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for spectrum creation.
  • out_of_gamut_clipping (bool, optional) – Whether to clip out of gamut colours otherwise, the colours will be offset by the absolute minimal colour leading to a rendering on gray background, less saturated and smoother. [1]_
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> visible_spectrum_plot()  
colour.plotting.single_lightness_function_plot(function='CIE 1976', **kwargs)[source]

Plots given Lightness function.

Parameters:function (unicode, optional) – Lightness function to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure

Examples

>>> single_lightness_function_plot()  
colour.plotting.multi_lightness_function_plot(functions=None, **kwargs)[source]

Plots given Lightness functions.

Parameters:functions (array_like, optional) – Lightness functions to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure
Raises:KeyError – If one of the given Lightness function is not found in the factory Lightness functions.

Examples

>>> fs = ('CIE 1976', 'Wyszecki 1963')
>>> multi_lightness_function_plot(fs)  
colour.plotting.blackbody_spectral_radiance_plot(temperature=3500, cmfs='CIE 1931 2 Degree Standard Observer', blackbody='VY Canis Major', **kwargs)[source]

Plots given blackbody spectral radiance.

Parameters:
  • temperature (numeric, optional) – Blackbody temperature.
  • cmfs (unicode, optional) – Standard observer colour matching functions.
  • blackbody (unicode, optional) – Blackbody name.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> blackbody_spectral_radiance_plot()  
colour.plotting.blackbody_colours_plot(shape=SpectralShape(150.0, 12500.0, 50.0), cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots blackbody colours.

Parameters:
  • shape (SpectralShape, optional) – Spectral shape to use as plot boundaries.
  • cmfs (unicode, optional) – Standard observer colour matching functions.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> blackbody_colours_plot()  
colour.plotting.colour_checker_plot(colour_checker='ColorChecker 2005', **kwargs)[source]

Plots given colour checker.

Parameters:

colour_checker (unicode, optional) – Color checker name.

Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Raises:

KeyError – If the given colour rendition chart is not found in the factory colour rendition charts.

Examples

>>> colour_checker_plot()  
colour.plotting.CIE_1931_chromaticity_diagram_plot(cmfs='CIE 1931 2 Degree Standard Observer', show_diagram_colours=True, **kwargs)[source]

Plots the CIE 1931 Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • show_diagram_colours (bool, optional) – Whether to display the chromaticity diagram background colours.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> CIE_1931_chromaticity_diagram_plot()  
colour.plotting.CIE_1960_UCS_chromaticity_diagram_plot(cmfs='CIE 1931 2 Degree Standard Observer', show_diagram_colours=True, **kwargs)[source]

Plots the CIE 1960 UCS Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • show_diagram_colours (bool, optional) – Whether to display the chromaticity diagram background colours.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> CIE_1960_UCS_chromaticity_diagram_plot()  
colour.plotting.CIE_1976_UCS_chromaticity_diagram_plot(cmfs='CIE 1931 2 Degree Standard Observer', show_diagram_colours=True, **kwargs)[source]

Plots the CIE 1976 UCS Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • show_diagram_colours (bool, optional) – Whether to display the chromaticity diagram background colours.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> CIE_1976_UCS_chromaticity_diagram_plot()  
colour.plotting.spds_CIE_1931_chromaticity_diagram_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', annotate=True, **kwargs)[source]

Plots given spectral power distribution chromaticity coordinates into the CIE 1931 Chromaticity Diagram.

Parameters:
  • spds (array_like, optional) – Spectral power distributions to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • annotate (bool) – Should resulting chromaticity coordinates annotated with their respective spectral power distribution names.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> A = ILLUMINANTS_RELATIVE_SPDS['A']
>>> D65 = ILLUMINANTS_RELATIVE_SPDS['D65']
>>> spds_CIE_1931_chromaticity_diagram_plot([A, D65])  
colour.plotting.spds_CIE_1960_UCS_chromaticity_diagram_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', annotate=True, **kwargs)[source]

Plots given spectral power distribution chromaticity coordinates into the CIE 1960 UCS Chromaticity Diagram.

Parameters:
  • spds (array_like, optional) – Spectral power distributions to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • annotate (bool) – Should resulting chromaticity coordinates annotated with their respective spectral power distribution names.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> A = ILLUMINANTS_RELATIVE_SPDS['A']
>>> D65 = ILLUMINANTS_RELATIVE_SPDS['D65']
>>> spds_CIE_1960_UCS_chromaticity_diagram_plot([A, D65])  
colour.plotting.spds_CIE_1976_UCS_chromaticity_diagram_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', annotate=True, **kwargs)[source]

Plots given spectral power distribution chromaticity coordinates into the CIE 1976 UCS Chromaticity Diagram.

Parameters:
  • spds (array_like, optional) – Spectral power distributions to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • annotate (bool) – Should resulting chromaticity coordinates annotated with their respective spectral power distribution names.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> A = ILLUMINANTS_RELATIVE_SPDS['A']
>>> D65 = ILLUMINANTS_RELATIVE_SPDS['D65']
>>> spds_CIE_1976_UCS_chromaticity_diagram_plot([A, D65])  
colour.plotting.corresponding_chromaticities_prediction_plot(experiment=1, model='Von Kries', transform='CAT02', **kwargs)[source]

Plots given chromatic adaptation model corresponding chromaticities prediction.

Parameters:
  • experiment (int, optional) – Corresponding chromaticities prediction experiment number.
  • model (unicode, optional) – Corresponding chromaticities prediction model name.
  • transform (unicode, optional) – Transformation to use with Von Kries chromatic adaptation model.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> corresponding_chromaticities_prediction_plot()  
colour.plotting.quad(plane='xy', origin=None, width=1, height=1, depth=0)[source]

Returns the vertices of a quad geometric element in counter-clockwise order.

Parameters:
  • plane (array_like, optional) – {‘xy’, ‘xz’, ‘yz’}, Construction plane of the quad.
  • origin (array_like, optional) – Quad origin on the construction plane.
  • width (numeric, optional) – Quad width.
  • height (numeric, optional) – Quad height.
  • depth (numeric, optional) – Quad depth.
Returns:

Quad vertices.

Return type:

ndarray

Examples

>>> quad()
array([[0, 0, 0],
       [1, 0, 0],
       [1, 1, 0],
       [0, 1, 0]])
colour.plotting.grid(plane='xy', origin=None, width=1, height=1, depth=0, width_segments=1, height_segments=1)[source]

Returns the vertices of a grid made of quads.

Parameters:
  • plane (array_like, optional) – {‘xy’, ‘xz’, ‘yz’}, Construction plane of the grid.
  • origin (array_like, optional) – Grid origin on the construction plane.
  • width (numeric, optional) – Grid width.
  • height (numeric, optional) – Grid height.
  • depth (numeric, optional) – Grid depth.
  • width_segments (int, optional) – Grid segments, quad counts along the width.
  • height_segments (int, optional) – Grid segments, quad counts along the height.
Returns:

Grid vertices.

Return type:

ndarray

Examples

>>> grid(width_segments=2, height_segments=2)
array([[[ 0. ,  0. ,  0. ],
        [ 0.5,  0. ,  0. ],
        [ 0.5,  0.5,  0. ],
        [ 0. ,  0.5,  0. ]],

       [[ 0. ,  0.5,  0. ],
        [ 0.5,  0.5,  0. ],
        [ 0.5,  1. ,  0. ],
        [ 0. ,  1. ,  0. ]],

       [[ 0.5,  0. ,  0. ],
        [ 1. ,  0. ,  0. ],
        [ 1. ,  0.5,  0. ],
        [ 0.5,  0.5,  0. ]],

       [[ 0.5,  0.5,  0. ],
        [ 1. ,  0.5,  0. ],
        [ 1. ,  1. ,  0. ],
        [ 0.5,  1. ,  0. ]]])
colour.plotting.cube(plane=None, origin=None, width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1)[source]

Returns the vertices of a cube made of grids.

Parameters:
  • plane (array_like, optional) – Any combination of {‘+x’, ‘-x’, ‘+y’, ‘-y’, ‘+z’, ‘-z’}, Included grids in the cube construction.
  • origin (array_like, optional) – Cube origin.
  • width (numeric, optional) – Cube width.
  • height (numeric, optional) – Cube height.
  • depth (numeric, optional) – Cube depth.
  • width_segments (int, optional) – Cube segments, quad counts along the width.
  • height_segments (int, optional) – Cube segments, quad counts along the height.
  • depth_segments (int, optional) – Cube segments, quad counts along the depth.
Returns:

Cube vertices.

Return type:

ndarray

Examples

>>> cube()
array([[[ 0.,  0.,  0.],
        [ 1.,  0.,  0.],
        [ 1.,  1.,  0.],
        [ 0.,  1.,  0.]],

       [[ 0.,  0.,  1.],
        [ 1.,  0.,  1.],
        [ 1.,  1.,  1.],
        [ 0.,  1.,  1.]],

       [[ 0.,  0.,  0.],
        [ 1.,  0.,  0.],
        [ 1.,  0.,  1.],
        [ 0.,  0.,  1.]],

       [[ 0.,  1.,  0.],
        [ 1.,  1.,  0.],
        [ 1.,  1.,  1.],
        [ 0.,  1.,  1.]],

       [[ 0.,  0.,  0.],
        [ 0.,  1.,  0.],
        [ 0.,  1.,  1.],
        [ 0.,  0.,  1.]],

       [[ 1.,  0.,  0.],
        [ 1.,  1.,  0.],
        [ 1.,  1.,  1.],
        [ 1.,  0.,  1.]]])
colour.plotting.RGB_colourspaces_CIE_1931_chromaticity_diagram_plot(colourspaces=None, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given RGB colourspaces in CIE 1931 Chromaticity Diagram.

Parameters:
  • colourspaces (array_like, optional) – RGB colourspaces to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = ['Rec. 709', 'ACEScg', 'S-Gamut']
>>> RGB_colourspaces_CIE_1931_chromaticity_diagram_plot(
...     c)  
colour.plotting.RGB_colourspaces_CIE_1960_UCS_chromaticity_diagram_plot(colourspaces=None, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given RGB colourspaces in CIE 1960 UCS Chromaticity Diagram.

Parameters:
  • colourspaces (array_like, optional) – RGB colourspaces to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = ['Rec. 709', 'ACEScg', 'S-Gamut']
>>> RGB_colourspaces_CIE_1960_UCS_chromaticity_diagram_plot(
...     c)  
colour.plotting.RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot(colourspaces=None, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given RGB colourspaces in CIE 1976 UCS Chromaticity Diagram.

Parameters:
  • colourspaces (array_like, optional) – RGB colourspaces to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = ['Rec. 709', 'ACEScg', 'S-Gamut']
>>> RGB_colourspaces_CIE_1976_UCS_chromaticity_diagram_plot(
...     c)  
colour.plotting.RGB_chromaticity_coordinates_CIE_1931_chromaticity_diagram_plot(RGB, colourspace, **kwargs)[source]

Plots given RGB colourspace array in CIE 1931 Chromaticity Diagram.

Parameters:
  • RGB (array_like) – RGB colourspace array.
  • colourspace (unicode) – RGB colourspace of the RGB array.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> RGB = np.random.random((10, 10, 3))
>>> c = 'Rec. 709'
>>> RGB_chromaticity_coordinates_CIE_1931_chromaticity_diagram_plot(
...     RGB, c)  
colour.plotting.RGB_chromaticity_coordinates_CIE_1960_UCS_chromaticity_diagram_plot(RGB, colourspace, **kwargs)[source]

Plots given RGB colourspace array in CIE 1960 UCS Chromaticity Diagram.

Parameters:
  • RGB (array_like) – RGB colourspace array.
  • colourspace (unicode) – RGB colourspace of the RGB array.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> RGB = np.random.random((10, 10, 3))
>>> c = 'Rec. 709'
>>> RGB_chromaticity_coordinates_CIE_1960_UCS_chromaticity_diagram_plot(
...     RGB, c)  
colour.plotting.RGB_chromaticity_coordinates_CIE_1976_UCS_chromaticity_diagram_plot(RGB, colourspace, **kwargs)[source]

Plots given RGB colourspace array in CIE 1976 UCS Chromaticity Diagram.

Parameters:
  • RGB (array_like) – RGB colourspace array.
  • colourspace (unicode) – RGB colourspace of the RGB array.
Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> RGB = np.random.random((10, 10, 3))
>>> c = 'Rec. 709'
>>> RGB_chromaticity_coordinates_CIE_1976_UCS_chromaticity_diagram_plot(
...     RGB, c)  
colour.plotting.single_cctf_plot(colourspace='Rec. 709', decoding_cctf=False, **kwargs)[source]

Plots given colourspace colour component transfer function.

Parameters:
  • colourspace (unicode, optional) – RGB Colourspace colour component transfer function to plot.
  • decoding_cctf (bool) – Plot decoding colour component transfer function instead.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> single_cctf_plot()  
colour.plotting.multi_cctf_plot(colourspaces=None, decoding_cctf=False, **kwargs)[source]

Plots given colourspaces colour component transfer functions.

Parameters:
  • colourspaces (array_like, optional) – Colourspaces colour component transfer function to plot.
  • decoding_cctf (bool) – Plot decoding colour component transfer function instead.
Other Parameters:
 

**kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> multi_cctf_plot(['Rec. 709', 'sRGB'])  
colour.plotting.single_munsell_value_function_plot(function='ASTM D1535-08', **kwargs)[source]

Plots given Lightness function.

Parameters:function (unicode, optional) – Munsell value function to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure

Examples

>>> f = 'ASTM D1535-08'
>>> single_munsell_value_function_plot(f)  
colour.plotting.multi_munsell_value_function_plot(functions=None, **kwargs)[source]

Plots given Munsell value functions.

Parameters:functions (array_like, optional) – Munsell value functions to plot.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure
Raises:KeyError – If one of the given Munsell value function is not found in the factory Munsell value functions.

Examples

>>> fs = ('ASTM D1535-08', 'McCamy 1987')
>>> multi_munsell_value_function_plot(fs)  
colour.plotting.single_rayleigh_scattering_spd_plot(CO2_concentration=300, temperature=288.15, pressure=101325, latitude=0, altitude=0, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots a single Rayleigh scattering spectral power distribution.

Parameters:
  • CO2_concentration (numeric, optional) – \(CO_2\) concentration in parts per million (ppm).
  • temperature (numeric, optional) – Air temperature \(T[K]\) in kelvin degrees.
  • pressure (numeric) – Surface pressure \(P\) of the measurement site.
  • latitude (numeric, optional) – Latitude of the site in degrees.
  • altitude (numeric, optional) – Altitude of the site in meters.
  • cmfs (unicode, optional) – Standard observer colour matching functions.
Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • out_of_gamut_clipping (bool, optional) – {single_spd_plot()}, Whether to clip out of gamut colours otherwise, the colours will be offset by the absolute minimal colour leading to a rendering on gray background, less saturated and smoother. [1]_
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> single_rayleigh_scattering_spd_plot()  
colour.plotting.the_blue_sky_plot(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots the blue sky.

Parameters:cmfs (unicode, optional) – Standard observer colour matching functions.
Other Parameters:
 **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
Returns:Current figure or None.
Return type:Figure

Examples

>>> the_blue_sky_plot()  
colour.plotting.single_spd_colour_rendering_index_bars_plot(spd, **kwargs)[source]

Plots the Colour Rendering Index (CRI) of given illuminant or light source spectral power distribution.

Parameters:

spd (SpectralPowerDistribution) – Illuminant or light source spectral power distribution to plot the Colour Rendering Index (CRI).

Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • labels (bool, optional) – {colour_quality_bars_plot()}, Add labels above bars.
  • hatching (bool or None, optional) – {colour_quality_bars_plot()}, Use hatching for the bars.
  • hatching_repeat (int, optional) – {colour_quality_bars_plot()}, Hatching pattern repeat.
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS['F2']
>>> single_spd_colour_rendering_index_bars_plot(  
...     illuminant)
colour.plotting.multi_spd_colour_rendering_index_bars_plot(spds, **kwargs)[source]

Plots the Colour Rendering Index (CRI) of given illuminants or light sources spectral power distributions.

Parameters:

spds (array_like) – Array of illuminants or light sources spectral power distributions to plot the Colour Rendering Index (CRI).

Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • labels (bool, optional) – {colour_quality_bars_plot()}, Add labels above bars.
  • hatching (bool or None, optional) – {colour_quality_bars_plot()}, Use hatching for the bars.
  • hatching_repeat (int, optional) – {colour_quality_bars_plot()}, Hatching pattern repeat.
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import (
...     ILLUMINANTS_RELATIVE_SPDS,
...     LIGHT_SOURCES_RELATIVE_SPDS)
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS['F2']
>>> light_source = LIGHT_SOURCES_RELATIVE_SPDS['Kinoton 75P']
>>> multi_spd_colour_rendering_index_bars_plot(  
...     [illuminant, light_source])
colour.plotting.single_spd_colour_quality_scale_bars_plot(spd, **kwargs)[source]

Plots the Colour Quality Scale (CQS) of given illuminant or light source spectral power distribution.

Parameters:

spd (SpectralPowerDistribution) – Illuminant or light source spectral power distribution to plot the Colour Quality Scale (CQS).

Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • labels (bool, optional) – {colour_quality_bars_plot()}, Add labels above bars.
  • hatching (bool or None, optional) – {colour_quality_bars_plot()}, Use hatching for the bars.
  • hatching_repeat (int, optional) – {colour_quality_bars_plot()}, Hatching pattern repeat.
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS['F2']
>>> single_spd_colour_quality_scale_bars_plot(  
...     illuminant)
colour.plotting.multi_spd_colour_quality_scale_bars_plot(spds, **kwargs)[source]

Plots the Colour Quality Scale (CQS) of given illuminants or light sources spectral power distributions.

Parameters:

spds (array_like) – Array of illuminants or light sources spectral power distributions to plot the Colour Quality Scale (CQS).

Other Parameters:
 
  • **kwargs (dict, optional) – {boundaries(), canvas(), decorate(), display()}, Please refer to the documentation of the previously listed definitions.
  • labels (bool, optional) – {colour_quality_bars_plot()}, Add labels above bars.
  • hatching (bool or None, optional) – {colour_quality_bars_plot()}, Use hatching for the bars.
  • hatching_repeat (int, optional) – {colour_quality_bars_plot()}, Hatching pattern repeat.
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> from colour import (
...     ILLUMINANTS_RELATIVE_SPDS,
...     LIGHT_SOURCES_RELATIVE_SPDS)
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS['F2']
>>> light_source = LIGHT_SOURCES_RELATIVE_SPDS['Kinoton 75P']
>>> multi_spd_colour_quality_scale_bars_plot(  
...     [illuminant, light_source])
colour.plotting.planckian_locus_CIE_1931_chromaticity_diagram_plot(illuminants=None, **kwargs)[source]

Plots the planckian locus and given illuminants in CIE 1931 Chromaticity Diagram.

Parameters:

illuminants (array_like, optional) – Factory illuminants to plot.

Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Raises:

KeyError – If one of the given illuminant is not found in the factory illuminants.

Examples

>>> ils = ['A', 'B', 'C']
>>> planckian_locus_CIE_1931_chromaticity_diagram_plot(
...     ils)  
colour.plotting.planckian_locus_CIE_1960_UCS_chromaticity_diagram_plot(illuminants=None, **kwargs)[source]

Plots the planckian locus and given illuminants in CIE 1960 UCS Chromaticity Diagram.

Parameters:

illuminants (array_like, optional) – Factory illuminants to plot.

Other Parameters:
 
Returns:

Current figure or None.

Return type:

Figure

Raises:

KeyError – If one of the given illuminant is not found in the factory illuminants.

Examples

>>> ils = ['A', 'C', 'E']
>>> planckian_locus_CIE_1960_UCS_chromaticity_diagram_plot(
...     ils)  
colour.plotting.RGB_colourspaces_gamuts_plot(colourspaces=None, reference_colourspace='CIE xyY', segments=8, display_grid=True, grid_segments=10, spectral_locus=False, spectral_locus_colour=None, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given RGB colourspaces gamuts in given reference colourspace.

Parameters:
  • colourspaces (array_like, optional) – RGB colourspaces to plot the gamuts.
  • reference_colourspace (unicode, optional) – {‘CIE XYZ’, ‘CIE xyY’, ‘CIE Lab’, ‘CIE Luv’, ‘CIE UCS’, ‘CIE UVW’, ‘IPT’, ‘Hunter Lab’, ‘Hunter Rdab’}, Reference colourspace to plot the gamuts into.
  • segments (int, optional) – Edge segments count for each RGB colourspace cubes.
  • display_grid (bool, optional) – Display a grid at the bottom of the RGB colourspace cubes.
  • grid_segments (bool, optional) – Edge segments count for the grid.
  • spectral_locus (bool, optional) – Is spectral locus line plotted.
  • spectral_locus_colour (array_like, optional) – Spectral locus line colour.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for spectral locus.
Other Parameters:
 
  • **kwargs (dict, optional) – {nadir_grid()}, Please refer to the documentation of the previously listed definitions.
  • face_colours (array_like, optional) – Face colours array such as face_colours = (None, (0.5, 0.5, 1.0)).
  • edge_colours (array_like, optional) – Edge colours array such as edge_colours = (None, (0.5, 0.5, 1.0)).
  • face_alpha (numeric, optional) – Face opacity value such as face_alpha = (0.5, 1.0).
  • edge_alpha (numeric, optional) – Edge opacity value such as edge_alpha = (0.0, 1.0).
Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = ['Rec. 709', 'ACEScg', 'S-Gamut']
>>> RGB_colourspaces_gamuts_plot(c)  
colour.plotting.RGB_scatter_plot(RGB, colourspace, reference_colourspace='CIE xyY', colourspaces=None, segments=8, display_grid=True, grid_segments=10, spectral_locus=False, spectral_locus_colour=None, points_size=12, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)[source]

Plots given RGB colourspace array in a scatter plot.

Parameters:
  • RGB (array_like) – RGB colourspace array.
  • colourspace (RGB_Colourspace) – RGB colourspace of the RGB array.
  • reference_colourspace (unicode, optional) – {‘CIE XYZ’, ‘CIE xyY’, ‘CIE Lab’, ‘CIE Luv’, ‘CIE UCS’, ‘CIE UVW’, ‘IPT’, ‘Hunter Lab’, ‘Hunter Rdab’}, Reference colourspace for colour conversion.
  • colourspaces (array_like, optional) – RGB colourspaces to plot the gamuts.
  • segments (int, optional) – Edge segments count for each RGB colourspace cubes.
  • display_grid (bool, optional) – Display a grid at the bottom of the RGB colourspace cubes.
  • grid_segments (bool, optional) – Edge segments count for the grid.
  • spectral_locus (bool, optional) – Is spectral locus line plotted.
  • spectral_locus_colour (array_like, optional) – Spectral locus line colour.
  • points_size (numeric, optional) – Scatter points size.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for spectral locus.
Other Parameters:
 

**kwargs (dict, optional) – {RGB_colourspaces_gamuts_plot()}, Please refer to the documentation of the previously listed definitions.

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = 'Rec. 709'
>>> RGB_scatter_plot(c)