Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Spurious import, tidied subplot call.

  • Loading branch information...
commit c5558109299463226be516691c0e357f19c43009 1 parent 74c55a6
Phil Elson authored
Showing with 5 additions and 7 deletions.
  1. +5 −7 examples/event_handling/lasso_demo.py
View
12 examples/event_handling/lasso_demo.py
@@ -7,16 +7,15 @@
usable as is). There will be some refinement of the API.
"""
from matplotlib.widgets import Lasso
-import matplotlib.mlab
from matplotlib.path import Path
from matplotlib.colors import colorConverter
from matplotlib.collections import RegularPolyCollection
-from matplotlib.pyplot import figure, show
+import matplotlib.pyplot as plt
from numpy import nonzero
from numpy.random import rand
-class Datum:
+class Datum(object):
colorin = colorConverter.to_rgba('red')
colorout = colorConverter.to_rgba('blue')
def __init__(self, x, y, include=False):
@@ -26,7 +25,7 @@ def __init__(self, x, y, include=False):
else: self.color = self.colorout
-class LassoManager:
+class LassoManager(object):
def __init__(self, ax, data):
self.axes = ax
self.canvas = ax.figure.canvas
@@ -71,8 +70,7 @@ def onpress(self, event):
data = [Datum(*xy) for xy in rand(100, 2)]
- fig = figure()
- ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
+ ax = plt.axes(xlim=(0,1), ylim=(0,1), autoscale_on=False)
lman = LassoManager(ax, data)
- show()
+ plt.show()

0 comments on commit c555810

Please sign in to comment.
Something went wrong with that request. Please try again.