>>> Benjamin Root 12/07/11 4:16 AM >>> > > Use draw_idle() if performance is an issue. Also, you don't have to redraw > everything. You can save the object returned by avline()
> and in subsequent draws, just modify the data. Usually, there is a set_data() > or a set_xy() method you can use for this. I didn't find those methods for the axvline. I thought it would have them like other Line2D objects. This now works, though it sometimes creates ghost double lines, and isn't the most performant solution: def update_marker(self, event): print "plotMarker() pos = ", event.xdata # DEBUG self.marker=self.ax1 #print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%( # event.button, event.x, event.y, event.xdata, event.ydata) # DEBUG # Create markers (vertical lines) in both plots self.marker=self.ax1.axvline(x=event.xdata, linewidth=1.5, color='r') self.marker=self.ax2.axvline(x=event.xdata, linewidth=1.5, color='r') # We need to remove all unnecessary marker in plot 1 and plot 2 # TODO: find better method, keeps double marker sometimes for i in range(1, len(self.ax1.lines)-1): self.ax1.lines[i].remove() for i in range(1, len(self.ax2.lines)-1): self.ax2.lines[i].remove() self.marker=self.ax1.axvline(x=event.xdata, linewidth=1.5, color='r') self.marker=self.ax1.axvline(x=event.xdata, linewidth=1.5, color='r') self.canvas.draw_idle() Thanks for the help. Cheers, Sven ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users