1

I want to plot the Mac Adam ellipses in different color spaces. For convenience I would like to show the possible sRGB Gamut too. Just like in this image (which is made with the colorio package too):

this

Here I encountered two problems:

  1. I don't know how to add the sRGB slice to the plot (it seems to use a different package for 3D plotting - namely pyvista instead of matplotlib)
  2. I'm not sure if this is a bug in the package because the given slice of the sRGB Gamut is not made in the Y axis but in x. colorio.plot_rgb_slice(cs, .2).show()

My code:

#!/usr/bin/env python3
import colorio

# colorspace
cs = colorio.cs.XYY1()

# Mac Adam ellipses
ellipses = colorio.data.MacAdam1942(1)
ellipses.plot(lambda: cs, ellipse_scaling=10)

# visible slice of xyY (works fine)
plt = colorio.plot_visible_slice(cs, 1)

# gamut slice of sRGB (no idea how to make this work)
# 0.2 value is necessary to be not out of range here due to the slice in x axis instead of Y for some reason
colorio.plot_rgb_slice(cs, .2)

plt.show()
  • 1
    I've never used colorio. Can you explain what "make this work" means? How does the last command "not work"? What kind of object is `plt`? (Side note: `plt` is a name you should avoid because that's the traditional import name of `matplotlib.pyplot`). – Andras Deak -- Слава Україні Aug 28 '21 at 15:17
  • I think the usage of `plt` here is intentional because it is a `matplotlib.pyplot` object. Probably not perfect - you are right, but I just copied the code example here. With "make this work" I mean adding the slice of the sRGB gamut to the `matplotlib` plot, because as i mentioned if you only run `colorio.plot_rgb_slice(cs, .2).show()` it creates a `pyvista` object. Now I'm struggling on passing this data to the plot. – Meredith Hesketh Fortescue Aug 29 '21 at 09:47
  • 1
    OK, wow, this is a really weird API. And I can't find documentation beyond the examples on pypi/github, _and_ there's no docstrings whatsoever. You should probably ask this question on [the issue tracker of colorio](https://github.com/nschloe/colorio/issues) or [their discord](https://discord.gg/hnTJ5MRX2Y), because nobody other than the developer will know how it works beyond basic examples. Perhaps you can use `colorio.save_rgb_gamut` to save into a mesh format from which you can pull out the 2d data to add to the matplotlib plot... – Andras Deak -- Слава Україні Aug 29 '21 at 11:27
  • 1
    Okay thank you very much. I will contact them. At least I am not the only one struggling here.. – Meredith Hesketh Fortescue Aug 29 '21 at 13:19

0 Answers0