On 11/16/2010 07:41 PM, Stan West wrote: > I believe I see how you could do it. The errorbar call returns the tuple p = > (plotline, caplines, barlinecols) [1], and to update the errorbars, you must > modify the objects in the caplines and barlinecols lists. Each element of the > caplines list is a Line2D artist [2] for the left, right, top, or bottom caps; > you can use its methods set_data, set_xdata, or set_ydata to modify its > coordinates, as you did for the main line. Each element of the barlinecols > list is a LineCollection [3] artist responsible for all of the x or y > errorbars; you can use the set_segments method to provide new coordinates. > > [1] > http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.errorbar > [2] > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D > [3] > http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection > Thanks Stan, with your suggestion I was able to solve the problem, even if it is not immediate (but not too long). This is what I did:
plotline, caplines, barlinecols = plt.errorbar(x, y, yerr, xerr) # Now move the line y = y/2. # Replot the data first plotline.set_data(x,y) # Find the ending points of the errorbars error_positions = (x-xerr,y), (x+xerr,y), (x,y-yerr), (x,y+yerr) # Update the caplines for i,pos in enumerate(error_positions): caplines[i].set_data(pos) # Update the error bars barlinecols[0].set_segments(zip(zip(x-xerr,y), zip(x+xerr,y))) barlinecols[1].set_segments(zip(zip(x,y-yerr), zip(x,y+yerr))) The last lines are a little clumsy, but I could not find a better way. Anyway, it could be nice to have a method like set_errorbar(x, y, yerr, xerr) to do the job. Many thanks again Gianfranco -- Istituto Nazionale di Ricerca Metrologica (I.N.Ri.M) (former Istituto Elettrotecnico Nazionale Galileo Ferraris) Strada delle Cacce, 91 - 10135 Torino Italy tel: ++39 011 3919839 fax: ++39 011 3919834 Personal home page: http://www.inrim.it/~durin/ INRiM home pag: http://www.inrim.it/ ============================================================= Please note my new e-mail: g.du...@inrim.it ============================================================= ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users