Skip to content

Commit 36f4714

Browse files
committed
Clip the elements of the streamplotset
Closes#391
1 parent 7e9f6fe commit 36f4714

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/streamplot_demo.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232
fig=plt.figure(figsize=(8,8))
3333
m=Basemap(projection='cyl',llcrnrlat=lats1[0],llcrnrlon=lons1[0],urcrnrlat=lats1[-1],urcrnrlon=lons1[-1],resolution='i')
3434
x, y=m(lons,lats)
35-
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.spectral)
36-
m.colorbar()
35+
m.drawmapboundary(fill_color='w')
3736
m.drawcoastlines()
3837
m.drawmeridians(np.arange(-120,-60,2),labels=[0,0,0,1])
3938
m.drawparallels(np.arange(0,30,2),labels=[1,0,0,0])
39+
40+
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.spectral)
41+
m.colorbar()
42+
4043
plt.title('Hurricane Rita flow field visualized with streamlines',\
4144
fontsize=13)
4245
plt.show()

lib/mpl_toolkits/basemap/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,8 @@ def streamplot(self, x, y, u, v, *args, **kwargs):
37293729
# set axes limits to fit map region.
37303730
self.set_axes_limits(ax=ax)
37313731
# clip to map limbs
3732-
ret,c=self._cliplimb(ax,ret)
3732+
ret.lines,c=self._cliplimb(ax,ret.lines)
3733+
ret.arrows,c=self._cliplimb(ax,ret.arrows)
37333734
# streamplot arrows not returned in matplotlib 1.1.1, so clip all
37343735
# FancyArrow patches attached to axes instance.
37353736
ifcisnotNone:

0 commit comments

Comments
 (0)
close