colour.plotting.volume Module

Colour Models Volume Plotting

Defines colour models volume and gamut plotting objects:

colour.plotting.volume.common_colourspace_model_axis_reorder(a, model=None)[source]

Reorder axis of given colourspace model \(a\) values accordingly to its most common volume plotting axis order.

Parameters:
  • a (array_like) – Colourspace model values \(a\).
  • model (unicode, optional) – {‘CIE XYZ’, ‘CIE xyY’, ‘CIE Lab’, ‘CIE Luv’, ‘CIE UCS’, ‘CIE UVW’, ‘IPT’, ‘Hunter Lab’, ‘Hunter Rdab’} Colourspace model.
Returns:

Reordered colourspace model values.

Return type:

Figure

Examples

>>> a = np.array([0, 1, 2])
>>> common_colourspace_model_axis_reorder(a)
array([0, 1, 2])
>>> common_colourspace_model_axis_reorder(a, 'CIE Lab')
array([1, 2, 0])
>>> common_colourspace_model_axis_reorder(a, 'CIE LCHab')
array([1, 2, 0])
>>> common_colourspace_model_axis_reorder(a, 'CIE Luv')
array([1, 2, 0])
>>> common_colourspace_model_axis_reorder(a, 'CIE LCHab')
array([1, 2, 0])
>>> common_colourspace_model_axis_reorder(a, 'IPT')
array([1, 2, 0])
colour.plotting.volume.nadir_grid(limits=None, segments=10, labels=None, axes=None, **kwargs)[source]

Returns a grid on xy plane made of quad geometric elements and its associated faces and edges colours. Ticks and labels are added to the given axes accordingly to the extended grid settings.

Parameters:
  • limits (array_like, optional) – Extended grid limits.
  • segments (int, optional) – Edge segments count for the extended grid.
  • labels (array_like, optional) – Axis labels.
  • axes (matplotlib.axes.Axes, optional) – Axes to add the grid.
  • **kwargs (dict, optional) – {‘grid_face_colours’, ‘grid_edge_colours’, ‘grid_face_alpha’, ‘grid_edge_alpha’, ‘x_axis_colour’, ‘y_axis_colour’, ‘x_ticks_colour’, ‘y_ticks_colour’, ‘x_label_colour’, ‘y_label_colour’, ‘ticks_and_label_location’}, Arguments for the nadir grid such as {'grid_face_colours': (0.25, 0.25, 0.25), 'grid_edge_colours': (0.50, 0.50, 0.50), 'grid_face_alpha': 0.1, 'grid_edge_alpha': 0.5, 'x_axis_colour': (0.0, 0.0, 0.0, 1.0), 'y_axis_colour': (0.0, 0.0, 0.0, 1.0), 'x_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'y_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'x_label_colour': (0.0, 0.0, 0.0, 0.85), 'y_label_colour': (0.0, 0.0, 0.0, 0.85), 'ticks_and_label_location': ('-x', '-y')}
Returns:

Grid quads, faces colours, edges colours.

Return type:

tuple

Examples

>>> nadir_grid(segments=1)
(array([[[-1.   , -1.   ,  0.   ],
        [ 1.   , -1.   ,  0.   ],
        [ 1.   ,  1.   ,  0.   ],
        [-1.   ,  1.   ,  0.   ]],

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

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

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

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

       [[-1.   , -0.001,  0.   ],
        [ 1.   , -0.001,  0.   ],
        [ 1.   ,  0.001,  0.   ],
        [-1.   ,  0.001,  0.   ]],

       [[-0.001, -1.   ,  0.   ],
        [ 0.001, -1.   ,  0.   ],
        [ 0.001,  1.   ,  0.   ],
        [-0.001,  1.   ,  0.   ]]]), array([[ 0.25,  0.25,  0.25,  0.1 ],
       [ 0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  0.  ],
       [ 0.  ,  0.  ,  0.  ,  1.  ],
       [ 0.  ,  0.  ,  0.  ,  1.  ]]), array([[ 0.5 ,  0.5 ,  0.5 ,  0.5 ],
       [ 0.75,  0.75,  0.75,  0.25],
       [ 0.75,  0.75,  0.75,  0.25],
       [ 0.75,  0.75,  0.75,  0.25],
       [ 0.75,  0.75,  0.75,  0.25],
       [ 0.  ,  0.  ,  0.  ,  1.  ],
       [ 0.  ,  0.  ,  0.  ,  1.  ]]))
colour.plotting.volume.RGB_identity_cube(plane=None, width_segments=16, height_segments=16, depth_segments=16)[source]

Returns an RGB identity cube made of quad geometric elements and its associated RGB colours.

Parameters:
  • plane (array_like, optional) – Any combination of {‘+x’, ‘-x’, ‘+y’, ‘-y’, ‘+z’, ‘-z’}, Included grids in the cube construction.
  • 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 quads, RGB colours.

Return type:

tuple

Examples

>>> vertices, RGB = RGB_identity_cube(None, 1, 1, 1)
>>> vertices
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.]]])
>>> RGB
array([[ 0.5,  0.5,  0. ],
       [ 0.5,  0.5,  1. ],
       [ 0.5,  0. ,  0.5],
       [ 0.5,  1. ,  0.5],
       [ 0. ,  0.5,  0.5],
       [ 1. ,  0.5,  0.5]])
colour.plotting.volume.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.
  • **kwargs (dict, optional) –

    {‘face_colours’, ‘edge_colours’, ‘edge_alpha’, ‘face_alpha’}, Arguments for each given colourspace where each key has an array_like value such as: { 'face_colours': (None, (0.5, 0.5, 1.0)), 'edge_colours': (None, (0.5, 0.5, 1.0)), 'edge_alpha': (0.5, 1.0), 'face_alpha': (0.0, 1.0)}

    {‘grid_face_colours’, ‘grid_edge_colours’, ‘grid_face_alpha’, ‘grid_edge_alpha’, ‘x_axis_colour’, ‘y_axis_colour’, ‘x_ticks_colour’, ‘y_ticks_colour’, ‘x_label_colour’, ‘y_label_colour’, ‘ticks_and_label_location’}, Arguments for the nadir grid such as {'grid_face_colours': (0.25, 0.25, 0.25), 'grid_edge_colours': (0.50, 0.50, 0.50), 'grid_face_alpha': 0.1, 'grid_edge_alpha': 0.5, 'x_axis_colour': (0.0, 0.0, 0.0, 1.0), 'y_axis_colour': (0.0, 0.0, 0.0, 1.0), 'x_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'y_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'x_label_colour': (0.0, 0.0, 0.0, 0.85), 'y_label_colour': (0.0, 0.0, 0.0, 0.85), 'ticks_and_label_location': ('-x', '-y')}

Returns:

Current figure or None.

Return type:

Figure

Examples

>>> c = ['Rec. 709', 'ACEScg', 'S-Gamut']
>>> RGB_colourspaces_gamuts_plot(c)  
colour.plotting.volume.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.
  • **kwargs (dict, optional) –

    {‘face_colours’, ‘edge_colours’, ‘edge_alpha’, ‘face_alpha’}, Arguments for each given colourspace where each key has an array_like value such as: { 'face_colours': (None, (0.5, 0.5, 1.0)), 'edge_colours': (None, (0.5, 0.5, 1.0)), 'edge_alpha': (0.5, 1.0), 'face_alpha': (0.0, 1.0)}

    {‘grid_face_colours’, ‘grid_edge_colours’, ‘grid_face_alpha’, ‘grid_edge_alpha’, ‘x_axis_colour’, ‘y_axis_colour’, ‘x_ticks_colour’, ‘y_ticks_colour’, ‘x_label_colour’, ‘y_label_colour’, ‘ticks_and_label_location’}, Arguments for the nadir grid such as {'grid_face_colours': (0.25, 0.25, 0.25), 'grid_edge_colours': (0.50, 0.50, 0.50), 'grid_face_alpha': 0.1, 'grid_edge_alpha': 0.5, 'x_axis_colour': (0.0, 0.0, 0.0, 1.0), 'y_axis_colour': (0.0, 0.0, 0.0, 1.0), 'x_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'y_ticks_colour': (0.0, 0.0, 0.0, 0.85), 'x_label_colour': (0.0, 0.0, 0.0, 0.85), 'y_label_colour': (0.0, 0.0, 0.0, 0.85), 'ticks_and_label_location': ('-x', '-y')}

Returns:

Current figure or None.

Return type:

Figure

Examples

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