Hi,

While playing around for an afternoon with colors in matplotlib, I came
across some inconsistencies. I was trying to define colors in sRGB (my
understanding is that sRGB as a standardized color space is
device-independent). Giving RGB values to matplotlib, I checked the
output with a color picker -- Color Maker from the Mac App Store, set
to the sRGB mode, but the built-in DigitalColor Meter gives the same
result. It turns out that the colors I see in the output are not what I
specified. This makes playing around with colors, a bit difficult:
http://nbviewer.ipython.org/gist/goerz/9aab94f5322d5a457625
As far as I can tell, Matplotlib does not specify in
which color model in interprets RGB values (this should ideally be
stated in the documentation). Also, the output in different backends
(IPython notebook, and interactive GUI) gave different results. As a
minimal example, consider the following:

    import pylab
    import numpy as np
    import matplotlib
    #%matplotlib inline
    # draw line with sRGB color 228, 26, 28
    pylab.plot(np.linspace(0,10, 10), np.linspace(0,20,10), linewidth=10,
               color=(0.894, 0.102, 0.110))
    pylab.show()
    # Colorpicker shows 210, 46, 13 in GUI view
    # Colorpicker shows 229, 39, 27 in iPython Notebook

In the IPython notebook, direct PIL graphics do seem to give the right
colors cf. In [5] in the linked IPython notebook (even though PIL also
does not explicitly specify its color model). Just matplotlib seems
off. Of course, I'm doing some slightly crazy stuff in the Notebook,
displaying every matplotlib output through PIL, but I cecked that
`%matplotlib inline` actually produces the same colors.

Should I file this on github as a bug report?

Best,
Michael

P.S.: please CC for direct replies

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to