colour.plotting Package

Module Contents

class colour.plotting.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.colour_cycle(colour_map='hsv', count=7)

Returns a colour cycle iterator using given colour map.

Parameters:
  • colour_map (unicode, optional) – Matplotlib colour map.
  • count (int, optional) – Cycle length.
Returns:

Colour cycle iterator.

Return type:

cycle

colour.plotting.canvas(**kwargs)

Sets the figure size and aspect.

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

Sets the figure decorations.

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

Sets the plot boundaries.

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

Sets the figure display.

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

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.colour_parameters_plot(colour_parameters, y0_plot=True, y1_plot=True, **kwargs)

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.single_colour_plot(colour_parameter, **kwargs)

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.multi_colour_plot(colour_parameters, width=1, height=1, spacing=0, across=3, text_display=True, text_size='large', text_offset=0.075, **kwargs)

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.5772645,  0.50453169))
>>> multi_colour_plot([cp1, cp2])  
True
colour.plotting.get_cmfs(cmfs)

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)

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.single_spd_plot(spd, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)

Plots given spectral power distribution.

Parameters:
  • spd (SpectralPowerDistribution) – Spectral power distribution to plot.
  • cmfs (unicode) – Standard observer colour matching functions used for spectrum creation.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

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) – Use spectral power distributions colours.
  • normalise_spds_colours (bool) – Should spectral power distributions colours normalised.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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

Plots given colour matching functions.

Parameters:
  • cmfs (unicode, optional) – Colour matching functions to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> single_cmfs_plot()  
True
colour.plotting.multi_cmfs_plot(cmfs=None, **kwargs)

Plots given colour matching functions.

Parameters:
  • cmfs (array_like, optional) – Colour matching functions to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> single_illuminant_relative_spd_plot()  
True
colour.plotting.multi_illuminants_relative_spd_plot(illuminants=None, **kwargs)

Plots given illuminants relative spectral power distributions.

Parameters:
  • illuminants (array_like, optional) – Factory illuminants to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots given Lightness function.

Parameters:
  • function (unicode, optional) – Lightness function to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> single_lightness_function_plot()  
True
colour.plotting.multi_lightness_function_plot(functions=None, **kwargs)

Plots given Lightness functions.

Parameters:
  • functions (array_like, optional) – Lightness functions to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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)  
True
colour.plotting.blackbody_spectral_radiance_plot(temperature=3500, cmfs='CIE 1931 2 Degree Standard Observer', blackbody='VY Canis Major', **kwargs)

Plots given blackbody spectral radiance.

Parameters:
  • temperature (numeric, optional) – Blackbody temperature.
  • cmfs (unicode, optional) – Standard observer colour matching functions.
  • blackbody (unicode, optional) – Blackbody name.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> blackbody_spectral_radiance_plot()  
True
colour.plotting.blackbody_colours_plot(shape=SpectralShape(150, 12500, 50), cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)

Plots blackbody colours.

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

Definition success.

Return type:

bool

Examples

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

Plots given colour checker.

Parameters:
  • colour_checker (unicode, optional) – Color checker name.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Raises:

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

Examples

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

Plots the CIE 1931 Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots the CIE 1960 UCS Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots the CIE 1976 UCS Chromaticity Diagram.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

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

Parameters:
  • spds (list, 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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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])  
True
colour.plotting.spds_CIE_1960_UCS_chromaticity_diagram_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', annotate=True, **kwargs)

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

Parameters:
  • spds (list, 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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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])  
True
colour.plotting.spds_CIE_1976_UCS_chromaticity_diagram_plot(spds, cmfs='CIE 1931 2 Degree Standard Observer', annotate=True, **kwargs)

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

Parameters:
  • spds (list, 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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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])  
True
colour.plotting.corresponding_chromaticities_prediction_plot(experiment=1, model='Von Kries', transform='CAT02', **kwargs)

Plots given chromatic adaptation model corresponding chromaticities prediction.

Parameters:
  • model (unicode, optional) – Corresponding chromaticities prediction models name.
  • model – Corresponding chromaticities prediction models name.
  • transform (unicode, optional) – Transformation to use with Von Kries chromatic adaptation model.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> corresponding_chromaticities_prediction_plot()  
True
colour.plotting.get_RGB_colourspace(colourspace)

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 colourspace is not found in the factory colourspaces.
colour.plotting.colourspaces_CIE_1931_chromaticity_diagram_plot(colourspaces=None, cmfs='CIE 1931 2 Degree Standard Observer', **kwargs)

Plots given colourspaces in CIE 1931 Chromaticity Diagram.

Parameters:
  • colourspaces (list, optional) – Colourspaces to plot.
  • cmfs (unicode, optional) – Standard observer colour matching functions used for diagram bounds.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> csps = ['sRGB', 'ACES2065-1']
>>> colourspaces_CIE_1931_chromaticity_diagram_plot(csps)  
True
colour.plotting.single_transfer_function_plot(colourspace='sRGB', **kwargs)

Plots given colourspace transfer function.

Parameters:
  • colourspace (unicode, optional) – RGB Colourspace transfer function to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> single_transfer_function_plot()  
True
colour.plotting.multi_transfer_function_plot(colourspaces=None, inverse=False, **kwargs)

Plots given colourspaces transfer functions.

Parameters:
  • colourspaces (list, optional) – Colourspaces transfer functions to plot.
  • inverse (bool) – Plot inverse transfer functions.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots given Lightness function.

Parameters:
  • function (unicode, optional) – Munsell value function to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots given Munsell value functions.

Parameters:
  • functions (array_like, optional) – Munsell value functions to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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)  
True
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)

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.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

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

Plots the blue sky.

Parameters:
  • cmfs (unicode, optional) – Standard observer colour matching functions.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> the_blue_sky_plot()  
True
colour.plotting.colour_quality_scale_bars_plot(spd, **kwargs)

Plots the colour quality scale of given illuminant or light source.

Parameters:
  • spd (SpectralPowerDistribution) – Illuminant or light source to plot the colour quality scale.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS.get('F2')
>>> colour_quality_scale_bars_plot(illuminant)  
True
colour.plotting.colour_rendering_index_bars_plot(spd, **kwargs)

Plots the colour rendering index of given illuminant or light source.

Parameters:
  • spd (SpectralPowerDistribution) – Illuminant or light source to plot the colour rendering index.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> illuminant = ILLUMINANTS_RELATIVE_SPDS.get('F2')
>>> colour_rendering_index_bars_plot(illuminant)  
True
colour.plotting.planckian_locus_CIE_1931_chromaticity_diagram_plot(illuminants=None, **kwargs)

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

Parameters:
  • illuminants (array_like, optional) – Factory illuminants to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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)    
True
colour.plotting.planckian_locus_CIE_1960_UCS_chromaticity_diagram_plot(illuminants=None, **kwargs)

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

Parameters:
  • illuminants (array_like, optional) – Factory illuminants to plot.
  • **kwargs (**) – Keywords arguments.
Returns:

Definition success.

Return type:

bool

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)    
True