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

colour-science / colour / 4207404108

pending completion
4207404108

push

github-actions

Thomas Mansencal
Merge branch 'feature/v0.4.3' into develop

4 of 4 new or added lines in 2 files covered. (100.0%)

29816 of 38555 relevant lines covered (77.33%)

0.77 hits per line

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

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

5
Defines 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 matplotlib.pyplot as plt
×
14
import numpy as np
×
15

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

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

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

36

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

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

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

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

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

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

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

79
    return plot_multi_munsell_value_functions((function,), **settings)
1✔
80

81

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

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

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

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

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

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

121
    functions_filtered = filter_passthrough(MUNSELL_VALUE_METHODS, functions)
122

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

132
    return plot_multi_functions(
1✔
133
        functions_filtered, samples=np.linspace(0, 100, 1000), **settings
134
    )
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