colour.plotting.common Module

Common Plotting

Defines the common plotting objects:

colour.plotting.common.PLOTTING_RESOURCES_DIRECTORY = '/Users/kelsolaar/Documents/Development/VirtualEnv/Colour2.7/lib/python2.7/site-packages/colour/plotting/resources'

Resources directory.

RESOURCES_DIRECTORY : unicode

colour.plotting.common.DEFAULT_FIGURE_SIZE = (14, 7)

Default plots figure size.

DEFAULT_FIGURE_SIZE : tuple

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.

__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(colour_map='hsv', count=7)[source]

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.common.figure_size(size=(14, 7))[source]

Sets figures sizes.

Parameters:size (tuple, optional) – Figure size.
Returns:Callable object.
Return type:object
colour.plotting.common.aspect(**kwargs)[source]

Sets the figure aspect.

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

Sets the plot bounding box.

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