|
9 | 9 | plot_planckian_locus_in_chromaticity_diagram_CIE1931` |
10 | 10 | - :func:`colour.plotting.\ |
11 | 11 | plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS` |
| 12 | +- :func:`colour.plotting.\ |
| 13 | +plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS` |
12 | 14 | """ |
13 | 15 |
|
14 | 16 | from __future__ import annotations |
|
47 | 49 | artist, |
48 | 50 | plot_chromaticity_diagram_CIE1931, |
49 | 51 | plot_chromaticity_diagram_CIE1960UCS, |
| 52 | + plot_chromaticity_diagram_CIE1976UCS, |
50 | 53 | filter_passthrough, |
51 | 54 | override_style, |
52 | 55 | render, |
|
76 | 79 | "plot_planckian_locus_in_chromaticity_diagram", |
77 | 80 | "plot_planckian_locus_in_chromaticity_diagram_CIE1931", |
78 | 81 | "plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS", |
| 82 | + "plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS", |
79 | 83 | ] |
80 | 84 |
|
81 | 85 |
|
@@ -408,7 +412,8 @@ def CCT_D_uv_to_plotting_colourspace(CCT_D_uv): |
408 | 412 | def plot_planckian_locus_in_chromaticity_diagram( |
409 | 413 | illuminants: str | Sequence[str], |
410 | 414 | 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", |
412 | 417 | annotate_kwargs: dict | List[dict] | None = None, |
413 | 418 | plot_kwargs: dict | List[dict] | None = None, |
414 | 419 | **kwargs: Any, |
@@ -485,7 +490,9 @@ def plot_planckian_locus_in_chromaticity_diagram( |
485 | 490 | :alt: plot_planckian_locus_in_chromaticity_diagram |
486 | 491 | """ |
487 | 492 |
|
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 | + ) |
489 | 496 |
|
490 | 497 | cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] |
491 | 498 |
|
@@ -531,6 +538,18 @@ def xy_to_ij(xy: NDArrayFloat) -> NDArrayFloat: |
531 | 538 |
|
532 | 539 | bounding_box = (-0.1, 0.7, -0.2, 0.6) |
533 | 540 |
|
| 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 | + |
534 | 553 | annotate_settings_collection = [ |
535 | 554 | { |
536 | 555 | "annotate": True, |
@@ -767,3 +786,84 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( |
767 | 786 | plot_kwargs=plot_kwargs, |
768 | 787 | **settings, |
769 | 788 | ) |
| 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 | + ) |
0 commit comments