Skip to content

Commit 2ab3eb9

Browse files
committed
user pcolorfast instead of imshow
1 parent c669811 commit 2ab3eb9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/matplotlib/axes.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -7941,15 +7941,13 @@ def hist2d(self, x, y, bins = 10, range=None, weights=None, cmin=None, cmax=None
79417941
Make a 2d histogram plot of *x* versus *y*, where *x*,
79427942
*y* are 1-D sequences of the same length
79437943
7944-
The return value is (counts,xedges,yedges,im)
7944+
The return value is (counts,xedges,yedges,PolyCollection)
79457945
79467946
Optional keyword arguments:
79477947
*bins*: [None | int | [int, int] | array_like | [array, array]]
79487948
The bin specification:
79497949
If int, the number of bins for the two dimensions (nx=ny=bins).
79507950
If [int, int], the number of bins in each dimension (nx, ny = bins).
7951-
If array_like, the bin edges for the two dimensions (x_edges=y_edges=bins).
7952-
If [array, array], the bin edges in each dimension (x_edges, y_edges = bins).
79537951
The default value is 10.
79547952
79557953
*range*: [*None* | array_like shape(2,2)]
@@ -7980,14 +7978,12 @@ def hist2d(self, x, y, bins = 10, range=None, weights=None, cmin=None, cmax=None
79807978
range = __builtins__["range"]
79817979
h,xedges,yedges = np.histogram2d(x, y, bins=bins, range=bin_range, normed=False, weights=weights)
79827980

7983-
if 'origin' not in kwargs: kwargs['origin']='lower'
7984-
if 'extent' not in kwargs: kwargs['extent']=[xedges[0], xedges[-1], yedges[0], yedges[-1]]
7985-
if 'interpolation' not in kwargs: kwargs['interpolation']='nearest'
7986-
if 'aspect' not in kwargs: kwargs['aspect']='auto'
79877981
if cmin is not None: h[h<cmin]=None
79887982
if cmax is not None: h[h>cmax]=None
79897983

7990-
im = self.imshow(h.T,**kwargs)
7984+
im = self.pcolorfast(xedges,yedges,h.T,**kwargs)
7985+
self.set_xlim(xedges[0],xedges[-1])
7986+
self.set_ylim(yedges[0],yedges[-1])
79917987

79927988
return h,xedges,yedges,im
79937989

0 commit comments

Comments
 (0)