Closed
Description
Bug report
Bug summary
When enough NaNs are in the data, tricontour
and tricontourf
would result in a segmentation fault.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
x,y=np.meshgrid(np.arange(10),np.arange(10))
z=x**2.+y**2.
z[x<y]=np.nan
fig,ax=plt.subplots()
ax.tricontourf(x.ravel(),y.ravel(),z.ravel())
#ax.tripcolor(x.ravel(),y.ravel(),z.ravel(),vmax=100,vmin=0)
plt.show()
Actual outcome
Segmentation fault (core dumped)
Expected outcome
tripcolor
gets a nice picture, no segmentation fault.
Here is the picture if I use ax.contourf(x,y,z)
instead:
Matplotlib version
- Operating system: Ubuntu 17.04
- Matplotlib version: 2.1.1+887.g2296775da.dirty
- Matplotlib backend (
print(matplotlib.get_backend())
):Qt5Agg - Python version: 2.7.13 and 3.5.3
- Jupyter version (if applicable):
- Other libraries:
I've tried both the deb package installed matplotlib, and the one from source. Also observed on older RHEL7 machine.
When running through gdb, it point to:
Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
TriContourGenerator::follow_interior (this=this@entry=0x555556666c40, contour_line=..., tri_edge=..., end_on_boundary=end_on_boundary@entry=false, level=@0x7fffffffcd10: -1e-13,
on_upper=on_upper@entry=false) at lib/matplotlib/tri/_tri.cpp:916
916 if (!end_on_boundary && _interior_visited[visited_index])