FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

imshow(..., alpha=0.5) produces different results in 2.x · Issue #6540 · matplotlib/matplotlib · GitHub

Repository navigation

imshow(..., alpha=0.5) produces different results in 2.x #6540

Description

I think I have whittled this down sufficiently from the Cartopy example that is failing. Running imshow(..., alpha=0.5) produces a different result in 2.0.0b1 vs. 1.5.1 (both installed via conda.)

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

# mpl.style.use('classic')

im = np.zeros((100, 100, 3), dtype=np.uint8)
plt.imshow(im, extent=(1, 10, 1, 10), alpha=0.5)
plt.xlim(0, 11)
plt.ylim(0, 11)

plt.savefig('imshow_alpha.png')

Using 1.5.1:

Using 2.0.0b1:

Using 2.0.0b1 with the classic style:

GIMP tells me that the first is 50%, while the latter two are 75%.

Activity

  1. added this to the milestone on Jun 6, 2016
  2. WeatherGod commented on Jun 7, 2016

    Member

    @mdboom, is this a result of the image architecture overhaul?

    On Mon, Jun 6, 2016 at 1:47 AM, Elliott Sales de Andrade <
    notifications@github.com> wrote:

    I think I have whittled this down sufficiently from the Cartopy example
    that is failing. Running imshow(..., alpha=0.5) produces a different
    result in 2.0.0b1 vs. 1.5.1 (both installed via conda.)

    import numpy as npimport matplotlib.pyplot as pltimport matplotlib as mpl

    mpl.style.use('classic')

    im = np.zeros((100, 100, 3), dtype=np.uint8)
    plt.imshow(im, extent=(1, 10, 1, 10), alpha=0.5)
    plt.xlim(0, 11)
    plt.ylim(0, 11)

    plt.savefig('imshow_alpha.png')

    Using 1.5.1:
    [image: imshow_alpha_1 5 1]
    https://cloud.githubusercontent.com/assets/302469/15812915/443b626e-2b88-11e6-89ca-14c0afbf4648.png
    Using 2.0.0b1:
    [image: imshow_alpha_2 0]
    https://cloud.githubusercontent.com/assets/302469/15812917/4d8bc746-2b88-11e6-8e9f-68a37cd456d6.png
    Using 2.0.0b1 with the classic style:
    [image: imshow_alpha_2 0_classic]
    https://cloud.githubusercontent.com/assets/302469/15812919/543d038e-2b88-11e6-9607-e80ae97955f6.png

    GIMP tells me that the first is 50%, while the latter two are 75%.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #6540, or mute the thread
    https://github.com/notifications/unsubscribe/AARy-NGkkXjrVwUIRPMnkrtSrR4Cnj66ks5qI7RogaJpZM4IulFm
    .

  3. WeatherGod commented on Jun 7, 2016

    Member

    I would be curious to know how the result compares with output from
    gtkcairo.

    On Tue, Jun 7, 2016 at 11:32 AM, Benjamin Root ben.v.root@gmail.com wrote:

    @mdboom, is this a result of the image architecture overhaul?

    On Mon, Jun 6, 2016 at 1:47 AM, Elliott Sales de Andrade <
    notifications@github.com> wrote:

    I think I have whittled this down sufficiently from the Cartopy example
    that is failing. Running imshow(..., alpha=0.5) produces a different
    result in 2.0.0b1 vs. 1.5.1 (both installed via conda.)

    import numpy as npimport matplotlib.pyplot as pltimport matplotlib as mpl

    mpl.style.use('classic')

    im = np.zeros((100, 100, 3), dtype=np.uint8)
    plt.imshow(im, extent=(1, 10, 1, 10), alpha=0.5)
    plt.xlim(0, 11)
    plt.ylim(0, 11)

    plt.savefig('imshow_alpha.png')

    Using 1.5.1:
    [image: imshow_alpha_1 5 1]
    https://cloud.githubusercontent.com/assets/302469/15812915/443b626e-2b88-11e6-89ca-14c0afbf4648.png
    Using 2.0.0b1:
    [image: imshow_alpha_2 0]
    https://cloud.githubusercontent.com/assets/302469/15812917/4d8bc746-2b88-11e6-8e9f-68a37cd456d6.png
    Using 2.0.0b1 with the classic style:
    [image: imshow_alpha_2 0_classic]
    https://cloud.githubusercontent.com/assets/302469/15812919/543d038e-2b88-11e6-9607-e80ae97955f6.png

    GIMP tells me that the first is 50%, while the latter two are 75%.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #6540, or mute the
    thread
    https://github.com/notifications/unsubscribe/AARy-NGkkXjrVwUIRPMnkrtSrR4Cnj66ks5qI7RogaJpZM4IulFm
    .

  4. QuLogic commented on Jun 8, 2016

    MemberAuthor

    I tried GTK3Cairo, but it's current broken:

    Traceback (most recent call last):
      File ".../lib/matplotlib/backends/backend_gtk3cairo.py", line 45, in on_draw_event
        self._render_figure(w, h)
      File ".../lib/matplotlib/backends/backend_gtk3cairo.py", line 34, in _render_figure
        self.figure.draw (self._renderer)
      File ".../lib/matplotlib/artist.py", line 63, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File ".../lib/matplotlib/figure.py", line 1129, in draw
        renderer, self, dsu, self.suppressComposite)
      File ".../lib/matplotlib/image.py", line 139, in _draw_list_compositing_images
        a.draw(renderer)
      File ".../lib/matplotlib/artist.py", line 63, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File ".../lib/matplotlib/axes/_base.py", line 2373, in draw
        mimage._draw_list_compositing_images(renderer, self, dsu)
      File ".../lib/matplotlib/image.py", line 163, in _draw_list_compositing_images
        flush_images()
      File ".../lib/matplotlib/image.py", line 147, in flush_images
        image_group[0].draw(renderer)
      File ".../lib/matplotlib/artist.py", line 63, in draw_wrapper
        draw(artist, renderer, *args, **kwargs)
      File ".../lib/matplotlib/image.py", line 472, in draw
        renderer.draw_image(gc, l, b, im)
      File ".../lib/matplotlib/backends/backend_cairo.py", line 180, in draw_image
        im.shape[1]*4)
    TypeError: expected a writeable buffer object
    
  5. tacaswell commented on Jun 8, 2016

    Member

    It looks like alpha is getting double applied?

  6. added a commit that references this issue on Jun 8, 2016
    ae3e8ed
  7. self-assigned this
    on Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL