(no subject)

Indeed, it works with Qt.

I'm going to report this as a bug then.
Thank you,
David

···

On Wed, Jan 13, 2016 at 12:29 PM, Jens Nielsen <jenshnielsen at gmail.com> wrote:

It looks like a bug in the OSX backend. I can reproduce with the OSX
backend but it looks correct with any other backend that also explains why
the saved images looks correct.
If you have other GUI toolkits installed you can switch by adding

import matplotlib
matplotlib.use('Qt4Agg') #Or any other backend

before importing pyplot the first time

best
Jens

On Wed, 13 Jan 2016 at 11:08 David Bourgeois <david at jaguarondi.com> wrote:

In Matplotlib, images and patches are shown on screen with different
color rendering, at least with my setup. The following script displays an
image of a grayscale (np.array) overlaid at the center with the same
grayscale generated from matplotlib.patches.

There is a difference of gamma between the image and the patches on
what's displayed on screen but if I save this figure, then the resulting
file is correct. Checking with some graphic software, the patches are
displaying the correct color, not the image.

Snapshot:
http://i.stack.imgur.com/mv8aU.jpg

Saving the figure from the figure window 'save' button gives this:
http://i.stack.imgur.com/fVNnh.png

Is there anything I'm missing in this code?

    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib.patches import Rectangle

    color = np.zeros(3)

    f, ax = plt.subplots()
    im = np.zeros((1000, 1100,3))
    for i in range(11):
        im[:,i*100:(i+1)*100,:] = np.tile(np.array([[color]]), (1000,
100, 1))
        ax.add_patch(Rectangle((i*100,300), 100, 400, linewidth=0,
facecolor=color))
        color = color + 0.1
    plt.imshow(im)
    plt.show()

I'm on OSX, so I also checked the color management and by changing the
color profile of my display, both image and patches are affected so I guess
color management is not where the problem lies.

Thank you,
David
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160113/21473dbc/attachment.html>