How to use the colorio.observers.cie_1931_2 function in colorio

To help you get started, we’ve selected a few colorio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / colorio / colorio / _color_space.py View on Github external
def plot_visible_slice(
        self, level, outline_prec=1.0e-2, plot_srgb_gamut=True, fill_color="0.8"
    ):
        # first plot the monochromatic outline
        mono_xy, conn_xy = get_mono_outline_xy(
            observer=cie_1931_2(), max_stepsize=outline_prec
        )

        mono_vals = numpy.array([self._bisect(xy, self.k0, level) for xy in mono_xy])
        conn_vals = numpy.array([self._bisect(xy, self.k0, level) for xy in conn_xy])

        k1, k2 = [k for k in [0, 1, 2] if k != self.k0]
        plt.plot(mono_vals[:, k1], mono_vals[:, k2], "-", color="k")
        plt.plot(conn_vals[:, k1], conn_vals[:, k2], ":", color="k")
        #
        if fill_color is not None:
            xyz = numpy.vstack([mono_vals, conn_vals[1:]])
            plt.fill(xyz[:, k1], xyz[:, k2], facecolor=fill_color, zorder=0)

        if plot_srgb_gamut:
            self._plot_srgb_gamut(self.k0, level)