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

colour-science / colour / 12452776384

22 Dec 2024 08:43AM UTC coverage: 97.524% (-1.7%) from 99.255%
12452776384

push

github

KelSolaar
Code formatting.

41247 of 42294 relevant lines covered (97.52%)

0.98 hits per line

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

88.46
/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
1✔
12

13
import typing
1✔
14

15
import numpy as np
1✔
16

17
if typing.TYPE_CHECKING:
1✔
18
    from matplotlib.axes import Axes
×
19
    from matplotlib.figure import Figure
×
20

21
if typing.TYPE_CHECKING:
1✔
22
    from colour.hints import Any, Callable, Dict, Sequence, Tuple
×
23

24
from colour.notation import MUNSELL_VALUE_METHODS
1✔
25
from colour.plotting import filter_passthrough, override_style, plot_multi_functions
26

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

34
__all__ = [
1✔
35
    "plot_single_munsell_value_function",
36
    "plot_multi_munsell_value_functions",
37
]
38

39

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

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

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

62
    Returns
63
    -------
64
    :class:`tuple`
65
        Current figure and axes.
66

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

72
    .. image:: ../_static/Plotting_Plot_Single_Munsell_Value_Function.png
73
        :align: center
74
        :alt: plot_single_munsell_value_function
75
    """
76

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

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

82

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

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

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

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

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

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

122
    functions_filtered = filter_passthrough(MUNSELL_VALUE_METHODS, functions)
123

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

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