Quadmesh with alpha without the nasty edge effects

I can’t work out if I’m having a brain block or it really can’t be done, but I’m trying to produce a pcolormesh with alpha without the nasty edges seen in the attached image

figure_1.png

The code to reproduce:

import matplotlib.pyplot as plt
import numpy.random

d = numpy.random.random([10, 10])
plt.pcolormesh(d, alpha=0.5, vmin=0, vmax=10)

plt.show()

I’ve tried several things, including:

  • Setting antialiased=False
  • Fiddling with the returned pcolormesh’s _is_stroked attribute
  • Rasterizing
  • Setting the edgecolor to ‘face’
    Pcolorfast is one option, but I was ideally hoping to achieve this with pcolormesh.

Any thoughts?

The issue is that the quads are overlapping just slightly. Any solution to
this has to be to make them not overlap at all. This is an old problem, to
be sure.

Ben Root

···

On Mon, May 13, 2013 at 9:58 AM, Phil Elson <pelson.pub@...149...> wrote:

I can't work out if I'm having a brain block or it really can't be done,
but I'm trying to produce a pcolormesh with alpha without the nasty edges
seen in the attached image

Yeah -- I think it's a known bug (though not sure if it's in the tracker).

The solution is probably to do something like the compound path rendering you (Phil) have experimented with, or, perhaps more easily, rendering without alpha to a temporary image buffer and then compositing it with alpha in a single step.

Mike

···

On 05/13/2013 10:14 AM, Benjamin Root wrote:

On Mon, May 13, 2013 at 9:58 AM, Phil Elson <pelson.pub@…149… > <mailto:pelson.pub@…149…>> wrote:

    I can't work out if I'm having a brain block or it really can't be
    done, but I'm trying to produce a pcolormesh with alpha without
    the nasty edges seen in the attached image

The issue is that the quads are overlapping just slightly. Any solution to this has to be to make them not overlap at all. This is an old problem, to be sure.

Ben Root

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel