Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca73ea3

Browse files
author
Jeff Whitaker
committed
make sure data points are plotted on top of filled contours.
svn path=/trunk/matplotlib/; revision=7966
1 parent d647774 commit ca73ea3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

examples/pylab_examples/griddata_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
z = x*np.exp(-x**2-y**2)
1212
# define grid.
1313
xi = np.linspace(-2.1,2.1,100)
14-
yi = np.linspace(-2.1,2.1,100)
14+
yi = np.linspace(-2.1,2.1,200)
1515
# grid the data.
16-
zi = griddata(x,y,z,xi,yi)
16+
zi = griddata(x,y,z,xi,yi,interp='linear')
1717
# contour the gridded data, plotting dots at the nonuniform data points.
1818
CS = plt.contour(xi,yi,zi,15,linewidths=0.5,colors='k')
1919
CS = plt.contourf(xi,yi,zi,15,cmap=plt.cm.jet)
2020
plt.colorbar() # draw colorbar
2121
# plot data points.
22-
plt.scatter(x,y,marker='o',c='b',s=5)
22+
plt.scatter(x,y,marker='o',c='b',s=5,zorder=10)
2323
plt.xlim(-2,2)
2424
plt.ylim(-2,2)
2525
plt.title('griddata test (%d points)' % npts)

0 commit comments

Comments
 (0)