You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tricontour and tricontourf can hang and enter an infinite loop in special circumstances. I give below a minimal working example reproducing the problem with Python 3.4.2, Matplotlib 1.4.3 and Numpy 1.9.2. The problem seems to be due to nearly collinear points, in fact it disappear by randomly perturbing the (x, y) coordinates by a minimal amount. In the example below, the problem also disappear by simply changing the rotation angle theta from 25 to 30 degrees.
import matplotlib.pyplot as plt
import numpy as np
xi = np.linspace(-2, 2, 100)
x, y = map(np.ravel, np.meshgrid(xi, xi))
z = np.exp(-x**2 - y**2)
w = x > y - 1
x, y, z = x[w], y[w], z[w]
theta = np.radians(25)
x1 = x*np.cos(theta) - y*np.sin(theta)
y1 = x*np.sin(theta) + y*np.cos(theta)
plt.tricontour(x1, y1, z, 15, linewidths=0.5)
The text was updated successfully, but these errors were encountered:
Bug confirmed somewhere in the Qhull to matplotlib interface. We're not always extracting the correct information from Qhull about the neighbors of triangles returned from the Qhull Delaunay triangulator. I am investigating further and will come up with a fix.
In the meantime, the problem can be avoided by adding a single line to lib/matplotlib/tri/triangulation.py. Line 55 is
tricontour and tricontourf can hang and enter an infinite loop in special circumstances. I give below a minimal working example reproducing the problem with Python 3.4.2, Matplotlib 1.4.3 and Numpy 1.9.2. The problem seems to be due to nearly collinear points, in fact it disappear by randomly perturbing the (x, y) coordinates by a minimal amount. In the example below, the problem also disappear by simply changing the rotation angle theta from 25 to 30 degrees.
The text was updated successfully, but these errors were encountered: