• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

colour-science / colour / 9579473519

19 Jun 2024 09:20AM UTC coverage: 2.36% (-97.6%) from 99.978%
9579473519

push

github

KelSolaar
Test only `colour/volume/tests`.

952 of 40339 relevant lines covered (2.36%)

0.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/colour/plotting/notation.py
1
"""
2
Colour Notation Systems Plotting
3
================================
4

5
Define the colour notation systems plotting objects:
6

7
-   :func:`colour.plotting.plot_single_munsell_value_function`
8
-   :func:`colour.plotting.plot_multi_munsell_value_functions`
9
"""
10

11
from __future__ import annotations
×
12

13
import numpy as np
×
14
from matplotlib.axes import Axes
×
15
from matplotlib.figure import Figure
×
16

17
from colour.hints import Any, Callable, Dict, Sequence, Tuple
×
18
from colour.notation import MUNSELL_VALUE_METHODS
×
19
from colour.plotting import (
20
    filter_passthrough,
21
    override_style,
22
    plot_multi_functions,
23
)
24

25
__author__ = "Colour Developers"
×
26
__copyright__ = "Copyright 2013 Colour Developers"
×
27
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
×
28
__maintainer__ = "Colour Developers"
×
29
__email__ = "colour-developers@colour-science.org"
×
30
__status__ = "Production"
×
31

32
__all__ = [
×
33
    "plot_single_munsell_value_function",
34
    "plot_multi_munsell_value_functions",
35
]
36

37

38
@override_style()
×
39
def plot_single_munsell_value_function(
×
40
    function: Callable | str, **kwargs: Any
41
) -> Tuple[Figure, Axes]:
42
    """
43
    Plot given *Lightness* function.
44

45
    Parameters
46
    ----------
47
    function
48
        *Munsell* value function to plot. ``function`` can be of any type or
49
        form supported by the :func:`colour.plotting.common.filter_passthrough`
50
        definition.
51

52
    Other Parameters
53
    ----------------
54
    kwargs
55
        {:func:`colour.plotting.artist`,
56
        :func:`colour.plotting.plot_multi_functions`,
57
        :func:`colour.plotting.render`},
58
        See the documentation of the previously listed definitions.
59

60
    Returns
61
    -------
62
    :class:`tuple`
63
        Current figure and axes.
64

65
    Examples
66
    --------
67
    >>> plot_single_munsell_value_function("ASTM D1535")  # doctest: +ELLIPSIS
68
    (<Figure size ... with 1 Axes>, <...Axes...>)
69

70
    .. image:: ../_static/Plotting_Plot_Single_Munsell_Value_Function.png
71
        :align: center
72
        :alt: plot_single_munsell_value_function
73
    """
74

75
    settings: Dict[str, Any] = {"title": f"{function} - Munsell Value Function"}
×
76
    settings.update(kwargs)
×
77

78
    return plot_multi_munsell_value_functions((function,), **settings)
×
79

80

81
@override_style()
×
82
def plot_multi_munsell_value_functions(
×
83
    functions: Callable | str | Sequence[Callable | str],
84
    **kwargs: Any,
85
) -> Tuple[Figure, Axes]:
86
    """
87
    Plot given *Munsell* value functions.
88

89
    Parameters
90
    ----------
91
    functions
92
        *Munsell* value functions to plot. ``functions`` elements can be of any
93
        type or form supported by the
94
        :func:`colour.plotting.common.filter_passthrough` definition.
95

96
    Other Parameters
97
    ----------------
98
    kwargs
99
        {:func:`colour.plotting.artist`,
100
        :func:`colour.plotting.plot_multi_functions`,
101
        :func:`colour.plotting.render`},
102
        See the documentation of the previously listed definitions.
103

104
    Returns
105
    -------
106
    :class:`tuple`
107
        Current figure and axes.
108

109
    Examples
110
    --------
111
    >>> plot_multi_munsell_value_functions(["ASTM D1535", "McCamy 1987"])
112
    ... # doctest: +ELLIPSIS
113
    (<Figure size ... with 1 Axes>, <...Axes...>)
114

115
    .. image:: ../_static/Plotting_Plot_Multi_Munsell_Value_Functions.png
116
        :align: center
117
        :alt: plot_multi_munsell_value_functions
118
    """
119

120
    functions_filtered = filter_passthrough(MUNSELL_VALUE_METHODS, functions)
121

122
    settings: Dict[str, Any] = {
×
123
        "bounding_box": (0, 100, 0, 10),
124
        "legend": True,
125
        "title": f"{', '.join(functions_filtered)} - Munsell Functions",
126
        "x_label": "Luminance Y",
127
        "y_label": "Munsell Value V",
128
    }
129
    settings.update(kwargs)
×
130

131
    return plot_multi_functions(
×
132
        functions_filtered, samples=np.linspace(0, 100, 1000), **settings
133
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc