Skip to content

Commit cdec149

Browse files
committed
Merge branch 'feature/v0.4.3' into develop
2 parents 1010890 + bde3db9 commit cdec149

File tree

4 files changed

+116
-2
lines changed

4 files changed

+116
-2
lines changed

colour/plotting/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
from .temperature import ( # noqa: E402
9999
plot_planckian_locus_in_chromaticity_diagram_CIE1931,
100100
plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS,
101+
plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS,
101102
)
102103
from .tm3018 import plot_single_sd_colour_rendition_report # noqa: E402
103104
from .volume import ( # noqa: E402
@@ -205,6 +206,7 @@
205206
__all__ += [
206207
"plot_planckian_locus_in_chromaticity_diagram_CIE1931",
207208
"plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS",
209+
"plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS",
208210
]
209211
__all__ += [
210212
"plot_single_sd_colour_rendition_report",

colour/plotting/temperature.py

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
plot_planckian_locus_in_chromaticity_diagram_CIE1931`
1010
- :func:`colour.plotting.\
1111
plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS`
12+
- :func:`colour.plotting.\
13+
plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS`
1214
"""
1315

1416
from __future__ import annotations
@@ -47,6 +49,7 @@
4749
artist,
4850
plot_chromaticity_diagram_CIE1931,
4951
plot_chromaticity_diagram_CIE1960UCS,
52+
plot_chromaticity_diagram_CIE1976UCS,
5053
filter_passthrough,
5154
override_style,
5255
render,
@@ -76,6 +79,7 @@
7679
"plot_planckian_locus_in_chromaticity_diagram",
7780
"plot_planckian_locus_in_chromaticity_diagram_CIE1931",
7881
"plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS",
82+
"plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS",
7983
]
8084

8185

@@ -408,7 +412,8 @@ def CCT_D_uv_to_plotting_colourspace(CCT_D_uv):
408412
def plot_planckian_locus_in_chromaticity_diagram(
409413
illuminants: str | Sequence[str],
410414
chromaticity_diagram_callable: Callable = plot_chromaticity_diagram,
411-
method: Literal["CIE 1931", "CIE 1960 UCS"] | str = "CIE 1931",
415+
method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"]
416+
| str = "CIE 1931",
412417
annotate_kwargs: dict | List[dict] | None = None,
413418
plot_kwargs: dict | List[dict] | None = None,
414419
**kwargs: Any,
@@ -485,7 +490,9 @@ def plot_planckian_locus_in_chromaticity_diagram(
485490
:alt: plot_planckian_locus_in_chromaticity_diagram
486491
"""
487492

488-
method = validate_method(method, ["CIE 1931", "CIE 1960 UCS"])
493+
method = validate_method(
494+
method, ["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"]
495+
)
489496

490497
cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
491498

@@ -531,6 +538,18 @@ def xy_to_ij(xy: NDArrayFloat) -> NDArrayFloat:
531538

532539
bounding_box = (-0.1, 0.7, -0.2, 0.6)
533540

541+
elif method == "CIE 1976 UCS":
542+
543+
def xy_to_ij(xy: NDArrayFloat) -> NDArrayFloat:
544+
"""
545+
Convert given *CIE xy* chromaticity coordinates to *ij*
546+
chromaticity coordinates.
547+
"""
548+
549+
return xy_to_Luv_uv(xy)
550+
551+
bounding_box = (-0.1, 0.7, -0.1, 0.7)
552+
534553
annotate_settings_collection = [
535554
{
536555
"annotate": True,
@@ -767,3 +786,84 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(
767786
plot_kwargs=plot_kwargs,
768787
**settings,
769788
)
789+
790+
791+
@override_style()
792+
def plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS(
793+
illuminants: str | Sequence[str],
794+
chromaticity_diagram_callable_CIE1976UCS: Callable = (
795+
plot_chromaticity_diagram_CIE1976UCS
796+
),
797+
annotate_kwargs: dict | List[dict] | None = None,
798+
plot_kwargs: dict | List[dict] | None = None,
799+
**kwargs: Any,
800+
) -> Tuple[plt.Figure, plt.Axes]:
801+
"""
802+
Plot the *Planckian Locus* and given illuminants in
803+
*CIE 1976 UCS Chromaticity Diagram*.
804+
805+
Parameters
806+
----------
807+
illuminants
808+
Illuminants to plot. ``illuminants`` elements can be of any
809+
type or form supported by the
810+
:func:`colour.plotting.common.filter_passthrough` definition.
811+
chromaticity_diagram_callable_CIE1976UCS
812+
Callable responsible for drawing the
813+
*CIE 1976 UCS Chromaticity Diagram*.
814+
annotate_kwargs
815+
Keyword arguments for the :func:`matplotlib.pyplot.annotate`
816+
definition, used to annotate the resulting chromaticity coordinates
817+
with their respective spectral distribution names. ``annotate_kwargs``
818+
can be either a single dictionary applied to all the arrows with same
819+
settings or a sequence of dictionaries with different settings for each
820+
spectral distribution. The following special keyword arguments can also
821+
be used:
822+
823+
- ``annotate`` : Whether to annotate the spectral distributions.
824+
plot_kwargs
825+
Keyword arguments for the :func:`matplotlib.pyplot.plot` definition,
826+
used to control the style of the plotted illuminants. ``plot_kwargs``
827+
can be either a single dictionary applied to all the plotted
828+
illuminants with the same settings or a sequence of dictionaries with
829+
different settings for eachplotted illuminant.
830+
831+
Other Parameters
832+
----------------
833+
kwargs
834+
{:func:`colour.plotting.artist`,
835+
:func:`colour.plotting.diagrams.plot_chromaticity_diagram`,
836+
:func:`colour.plotting.temperature.plot_planckian_locus`,
837+
:func:`colour.plotting.temperature.\
838+
plot_planckian_locus_in_chromaticity_diagram`,
839+
:func:`colour.plotting.render`},
840+
See the documentation of the previously listed definitions.
841+
842+
Returns
843+
-------
844+
:class:`tuple`
845+
Current figure and axes.
846+
847+
Examples
848+
--------
849+
>>> plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS(
850+
... ["A", "C", "E"]
851+
... ) # doctest: +ELLIPSIS
852+
(<Figure size ... with 1 Axes>, <...Axes...>)
853+
854+
.. image:: ../_static/Plotting_\
855+
Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1976UCS.png
856+
:align: center
857+
:alt: plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS
858+
"""
859+
860+
settings = dict(kwargs)
861+
settings.update({"method": "CIE 1976 UCS"})
862+
863+
return plot_planckian_locus_in_chromaticity_diagram(
864+
illuminants,
865+
chromaticity_diagram_callable_CIE1976UCS,
866+
annotate_kwargs=annotate_kwargs,
867+
plot_kwargs=plot_kwargs,
868+
**settings,
869+
)

docs/colour.plotting.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ Colour Temperature & Correlated Colour Temperature
262262

263263
plot_planckian_locus_in_chromaticity_diagram_CIE1931
264264
plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS
265+
plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS
265266

266267
**Ancillary Objects**
267268

utilities/generate_plots.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
plot_multi_sds,
6969
plot_planckian_locus_in_chromaticity_diagram_CIE1931,
7070
plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS,
71+
plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS,
7172
plot_pointer_gamut,
7273
plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931,
7374
plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS,
@@ -997,6 +998,16 @@ def generate_documentation_plots(output_directory: str):
997998
)[0]
998999
)
9991000

1001+
arguments["filename"] = os.path.join(
1002+
output_directory,
1003+
"Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1976UCS.png",
1004+
)
1005+
plt.close(
1006+
plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS(
1007+
["A", "B", "C"], **arguments
1008+
)[0]
1009+
)
1010+
10001011
arguments["filename"] = os.path.join(
10011012
output_directory,
10021013
"Plotting_Plot_Single_SD_Colour_Rendition_Report_Full.png",

0 commit comments

Comments
 (0)