Le lundi 12 mai 2008 à 11:08 +0200, Johann Cohen-Tanugi a écrit : > hello, > I have a function, which I am plotting. I want to add a line positioned > at, say, the mean of the function, so I want to do plot([x,x],[y0,y1]). > In order to get y0, and y1, my brute force trial and error browsing of > the API lead me to : > y0=gca().yaxis.get_majorticklabels()[0].get_position()[1] > y1=gca().yaxis.get_majorticklabels()[-1].get_position()[1]
line = gca().get_lines()[0] y0 = line.get_ydata().min() y1 = line.get_ydata().max() should work (sorry I did not checked) -- Fabricio ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users