A contourf bug?

Hi Everyone,

Looks like I may have run into a bug for the contourf function. I was able to reproduce the problem on two OS X systems. One was based on 10.5 and the other was on 10.4. The problem appears when you use contourf with alpha < 1. With the transparency there appears to be streaks of lines pointing downward from the contour lines. Is this a bug that has been spotted before? Additional information is provided below with a python script to reproduce the problem.

Note, this bug was reproduced with a range of different parameters and input values. The script is the easiest way to reproduce the problem.

Cheers,

Eli

Mac OSX Darwin Kernel Version 9.5.0 (Leopard 10.5.5)

Matplotlib version: 0.98.3

Matplotlib was installed via EPD, version Py2.5 4.1.30101 i386

Code to show bug:
Most of the python code was borrowed from the Matplotlib examples
http://matplotlib.sourceforge.net/examples/pylab_examples/contour_demo.html?highlight=contours

###### Begin Python Code #######
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10.0 * (Z2 - Z1)

plt.figure()
CS = plt.contourf(X, Y, Z,alpha = 0.7)
###### End Python Code #######

Eli Bressert wrote:

Hi Everyone,

Looks like I may have run into a bug for the contourf function. I was able to reproduce the problem on two OS X systems. One was based on 10.5 and the other was on 10.4. The problem appears when you use contourf with alpha < 1. With the transparency there appears to be streaks of lines pointing downward from the contour lines. Is this a bug that has been spotted before? Additional information is provided below with a python script to reproduce the problem.

Note, this bug was reproduced with a range of different parameters and input values. The script is the easiest way to reproduce the problem.

It is partly inherent in the underlying contouring algorithm, and I think partly reflecting a common characteristic of renderers. On my ubuntu box, the problem shows up in agg, pdf or ps shown with evince, but *not* in svg rendered by eog.

The part inherent in the contouring algorithm is that all patches are simply connected--the algorithm does not make annular patches, for example--so there is a vertical cut. With alpha < 1, that cut, and for that matter the boundary between one patch and the next, seem to be effectively rendered twice. The contour code is already specifying that the patch should be rendered without a boundary, so I don't know what else can be done.

Eric

ยทยทยท

Cheers,

Eli

Mac OSX Darwin Kernel Version 9.5.0 (Leopard 10.5.5)

Matplotlib version: 0.98.3

Matplotlib was installed via EPD, version Py2.5 4.1.30101 i386

Code to show bug:
Most of the python code was borrowed from the Matplotlib examples
http://matplotlib.sourceforge.net/examples/pylab_examples/contour_demo.html?highlight=contours

###### Begin Python Code #######
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10.0 * (Z2 - Z1)

plt.figure()
CS = plt.contourf(X, Y, Z,alpha = 0.7)
###### End Python Code #######

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options