colour.plotting.common Module¶
Common Plotting¶
Defines the common plotting objects:
colour_cycle()
canvas()
camera()
decorate()
boundaries()
display()
label_rectangles()
equal_axes3d()
colour_parameters_plot()
single_colour_plot()
multi_colour_plot()
image_plot()
-
colour.plotting.common.
PLOTTING_RESOURCES_DIRECTORY
= '/home/docs/checkouts/readthedocs.org/user_builds/colour/envs/v0.3.7/local/lib/python2.7/site-packages/colour_science-0.3.7-py2.7.egg/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
= 18¶ Default figure width.
DEFAULT_FIGURE_WIDTH : integer
-
colour.plotting.common.
DEFAULT_FIGURE_HEIGHT
= 11.124611797498108¶ Default figure height.
DEFAULT_FIGURE_HEIGHT : integer
-
colour.plotting.common.
DEFAULT_FIGURE_SIZE
= (18, 11.124611797498108)¶ Default figure size.
DEFAULT_FIGURE_SIZE : tuple
-
colour.plotting.common.
DEFAULT_FONT_SIZE
= 12¶ Default figure font size.
DEFAULT_FONT_SIZE : numeric
-
colour.plotting.common.
DEFAULT_COLOUR_CYCLE
= ('r', 'g', 'b', 'c', 'm', 'y', 'k')¶ Default colour cycle for plots.
DEFAULT_COLOUR_CYCLE : tuple {‘r’, ‘g’, ‘b’, ‘c’, ‘m’, ‘y’, ‘k’}
-
colour.plotting.common.
DEFAULT_HATCH_PATTERNS
= ('\\\\', 'o', 'x', '.', '*', '//')¶ Default hatch patterns for bar plots.
DEFAULT_HATCH_PATTERNS : tuple {‘\’, ‘o’, ‘x’, ‘.’, ‘*’, ‘//’}
-
colour.plotting.common.
DEFAULT_PARAMETERS
= {'font.size': 12, 'figure.figsize': (18, 11.124611797498108), 'ytick.labelsize': 12, 'xtick.labelsize': 12, 'axes.titlesize': 15.0, 'legend.fontsize': 10.8, 'axes.labelsize': 15.0, 'axes.color_cycle': ('r', 'g', 'b', 'c', 'm', 'y', 'k')}¶ Default plotting parameters.
DEFAULT_PARAMETERS : dict
-
colour.plotting.common.
DEFAULT_PLOTTING_ILLUMINANT
= (0.31271, 0.32902)¶ Default plotting illuminant: CIE Illuminant D Series D65.
DEFAULT_PLOTTING_ILLUMINANT : tuple
-
colour.plotting.common.
DEFAULT_PLOTTING_OECF
(value)¶ Default plotting OECF / opto-electronic conversion function: sRGB.
DEFAULT_PLOTTING_OECF : object
-
class
colour.plotting.common.
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.
-
colour.plotting.common.
colour_cycle
(**kwargs)[source]¶ Returns a colour cycle iterator using given colour map.
Parameters: **kwargs (dict, optional) – {‘colour_cycle_map’, ‘colour_cycle_count’} Keywords arguments such as {'colour_cycle_map': unicode (Matplotlib colormap name), 'colour_cycle_count': int}
Returns: Colour cycle iterator. Return type: cycle
-
colour.plotting.common.
canvas
(**kwargs)[source]¶ Sets the figure size.
Parameters: **kwargs (dict, optional) – {‘figure_size’, } Keywords arguments such as {'figure_size': array_like (width, height), }
Returns: Current figure. Return type: Figure
-
colour.plotting.common.
camera
(**kwargs)[source]¶ Sets the camera settings.
Parameters: **kwargs (dict, optional) – {‘camera_aspect’, ‘elevation’, ‘azimuth’} Keywords arguments such as {'camera_aspect': unicode (Matplotlib axes aspect), 'elevation' : numeric, 'azimuth' : numeric}
Returns: Definition success. Return type: bool
-
colour.plotting.common.
decorate
(**kwargs)[source]¶ Sets the figure decorations.
Parameters: **kwargs (dict, optional) – {‘title’, ‘x_label’, ‘y_label’, ‘legend’, ‘legend_columns’, ‘legend_location’, ‘x_ticker’, ‘y_ticker’, ‘x_ticker_locator’, ‘y_ticker_locator’, ‘grid’, ‘grid_which’, ‘grid_axis’, ‘x_axis_line’, ‘y_axis_line’, ‘aspect’, ‘no_axes3d’} Keywords arguments such as {'title': unicode (figure title), 'x_label': unicode (X axis label), 'y_label': unicode (Y axis label), 'legend': bool, 'legend_columns': int, 'legend_location': unicode (Matplotlib legend location), 'x_ticker': bool, 'y_ticker': bool, 'x_ticker_locator': Locator, 'y_ticker_locator': Locator, 'grid': bool, 'grid_which': unicode, 'grid_axis': unicode, 'x_axis_line': bool, 'y_axis_line': bool, 'aspect': unicode (Matplotlib axes aspect), 'no_axes3d': bool}
Returns: Definition success. Return type: bool
-
colour.plotting.common.
boundaries
(**kwargs)[source]¶ Sets the plot boundaries.
Parameters: **kwargs (dict, optional) – {‘bounding_box’, ‘x_tighten’, ‘y_tighten’, ‘limits’, ‘margins’} Keywords arguments such as {'bounding_box': array_like (x min, x max, y min, y max), 'x_tighten': bool, 'y_tighten': bool, 'limits': array_like (x min, x max, y min, y max), 'limits': array_like (x min, x max, y min, y max)}
Returns: Definition success. Return type: bool
-
colour.plotting.common.
display
(**kwargs)[source]¶ Sets the figure display.
Parameters: **kwargs (dict, optional) – {‘standalone’, ‘filename’} Keywords arguments such as {'standalone': bool (figure is shown), 'filename': unicode (figure is saved as `filename`)}
Returns: Definition success. Return type: bool
-
colour.plotting.common.
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:
-
colour.plotting.common.
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.common.
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.common.
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.common.
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.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 (dict, optional) – Keywords arguments.
Returns: Definition success.
Return type: 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]) True
-
colour.plotting.common.
single_colour_plot
(colour_parameter, **kwargs)[source]¶ Plots given colour.
Parameters: - colour_parameter (ColourParameter) – ColourParameter.
- **kwargs (dict, optional) – Keywords arguments.
Returns: Definition success.
Return type: Examples
>>> RGB = (0.32315746, 0.32983556, 0.33640183) >>> single_colour_plot(ColourParameter(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 (dict, optional) – Keywords arguments.
Returns: Definition success.
Return type: Examples
>>> cp1 = ColourParameter(RGB=(0.45293517, 0.31732158, 0.26414773)) >>> cp2 = ColourParameter(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, interpolation='nearest', colour_map=<Mock name='mock.cm.Greys_r' id='140326128301904'>, **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.
- **kwargs (dict, optional) – Keywords arguments.
Returns: Definition success.
Return type: 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