@@ -1689,7 +1689,6 @@ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
16891689
16901690 Parameters
16911691 ----------
1692-
16931692 x : sequence of scalars of length n
16941693
16951694 y : sequence of scalars of length n
@@ -1743,10 +1742,10 @@ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
17431742 x = detrend (np .asarray (x ))
17441743 y = detrend (np .asarray (y ))
17451744
1746- c = np .correlate (x , y , mode = 2 )
1745+ correls = np .correlate (x , y , mode = 2 )
17471746
17481747 if normed :
1749- c /= np .sqrt (np .dot (x , x ) * np .dot (y , y ))
1748+ correls /= np .sqrt (np .dot (x , x ) * np .dot (y , y ))
17501749
17511750 if maxlags is None :
17521751 maxlags = Nx - 1
@@ -1756,18 +1755,19 @@ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
17561755 'positive < %d' % Nx )
17571756
17581757 lags = np .arange (- maxlags , maxlags + 1 )
1759- c = c [Nx - 1 - maxlags :Nx + maxlags ]
1758+ correls = correls [Nx - 1 - maxlags :Nx + maxlags ]
17601759
17611760 if usevlines :
1762- a = self .vlines (lags , [0 ], c , ** kwargs )
1761+ a = self .vlines (lags , [0 ], correls , ** kwargs )
1762+ # Make label empty so only vertical lines get a legend entry
1763+ kwargs ['label' ] = ''
17631764 b = self .axhline (** kwargs )
17641765 else :
1765-
17661766 kwargs .setdefault ('marker' , 'o' )
17671767 kwargs .setdefault ('linestyle' , 'None' )
1768- a , = self .plot (lags , c , ** kwargs )
1768+ a , = self .plot (lags , correls , ** kwargs )
17691769 b = None
1770- return lags , c , a , b
1770+ return lags , correls , a , b
17711771
17721772 #### Specialized plotting
17731773
0 commit comments