On 21/08/10 21:14, Jose Gómez-Dans wrote: > Use plt.text (x, y, point_labels ) or something along those lines. > > Jose >
With plt.text() the plot line is sometimes covered by the point labels. Is there any option which recognise a collusion between the line and label? from pylab import * import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] y = [20, 24, 8, 4, 12, 22, 31, 25, 15, 28, 12, 27, 22, 22, 27, 14, 32, 28, 8, 17, 2, 8, 29, 13, 14, 20, 11, 28, 8] point_labels = ['A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1'] fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('The red point should be on the path') ax.plot(x, y, 'go-') ax.grid(True) # rotates and right aligns the x labels, and moves the bottom of the # axes up to make room for them fig.autofmt_xdate() # set x and y labels plt.xticks(range(0, 40, 1)) #ax.set_xticks(4.5) plt.yticks(range(0, 40, 1)) for i, label in enumerate(point_labels): plt.text (x[i], y[i], label ) plt.show() ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users