From: leonardo <le...@ya...> - 2005-03-11 12:45:58
|
I'd like to draw lots of (2-point) segments (and then lots of dots/cirles) in a Tk window (probably using LineCollection), can you show me a tiny example? I've found very useful the "Screenshots" page on the site. I've tried to do for myself, but so far I've failed. In the tutorial there is: from matplotlib.backends.backend_agg import RendererAgg from matplotlib.transforms import Value dpi = Value(72.0) o = RendererAgg(400, 400, dpi) gc = o.new_gc() o.draw_lines(gc, (50, 100, 150, 200, 250), (400, 100, 300, 200, 250) ) o._renderer.write_png('saved.png') (But it's for lines composed of many segments, and it doesn't show the result in a window). Using LineCollection, but this is still wrong: from pylab import * import matplotlib.collections as col line1 = ((1,3),(4,6)) line2 = ((3,6),(2,1)) linest = (line1, line2) lc = col.LineCollection(linest) lc.show() #show() Thank you, leonardo __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ |