44"""
55
66from matplotlib .lines import Line2D
7- import matplotlib . numerix as nx
7+ import numpy as npy
88from pylab import figure , show
99
1010class ClippedLine (Line2D ):
@@ -19,13 +19,13 @@ def __init__(self, ax, *args, **kwargs):
1919
2020 def set_data (self , * args , ** kwargs ):
2121 Line2D .set_data (self , * args , ** kwargs )
22- self .xorig = nx .array (self ._x )
23- self .yorig = nx .array (self ._y )
22+ self .xorig = npy .array (self ._x )
23+ self .yorig = npy .array (self ._y )
2424
2525 def draw (self , renderer ):
2626 xlim = self .ax .get_xlim ()
2727
28- ind0 , ind1 = nx .searchsorted (self .xorig , xlim )
28+ ind0 , ind1 = npy .searchsorted (self .xorig , xlim )
2929 self ._x = self .xorig [ind0 :ind1 ]
3030 self ._y = self .yorig [ind0 :ind1 ]
3131 N = len (self ._x )
@@ -43,8 +43,8 @@ def draw(self, renderer):
4343fig = figure ()
4444ax = fig .add_subplot (111 , autoscale_on = False )
4545
46- t = nx .arange (0.0 , 100.0 , 0.01 )
47- s = nx .sin (2 * nx .pi * t )
46+ t = npy .arange (0.0 , 100.0 , 0.01 )
47+ s = npy .sin (2 * npy .pi * t )
4848line = ClippedLine (ax , t , s , color = 'g' , ls = '-' , lw = 2 )
4949ax .add_line (line )
5050ax .set_xlim (10 ,30 )
0 commit comments