Skip to content
Advertisement

How to remove edge lines from tripcolor plot with alpha != 0?

The matplotlib.pyplot.tripcolor example produces this image:

If I change the plotting line from

JavaScript

to

JavaScript

then coloured edges appear:

Adding antialiased=True makes things a bit better, but edges are still visible:

Nothing else I tried changed the appearance of the edges. They seem unaffected by setting linewidths or edgecolors, nor by the methods set_linewidth or set_edgewidths on the tpc object.

How can I plot a transparent tripcolor without edges?

Advertisement

Answer

I think it’s kind of inevitable that there will be some overlap or space between non-rectangularly positionned patches on a discrete grid (the image).

For the example case however, there seems to be little reason to use any alpha. Instead, using alpha blending and creating a new colormap with those blended colors, gives the same result.

JavaScript

enter image description here

Else, you can of course increase the dpi to insane values to get rid of the spacing. E.g. dpi=1000 (instead of the dpi=72 used in the question) gives a picture with no edges to be observable.

enter image description here

Advertisement