[Matplotlib-users] Label for axhline

2012-11-28 Thread Mads Ipsen
Hi, I would like to add a label or tick label for an axhline(), in such a way that the labels follows the location of the hline. The x-coordinate of the label should be in screen coordinates (a little to the right of the plot) - but the y-coordinate should be in data coordinates. Any good

Re: [Matplotlib-users] Label for axhline

2012-11-28 Thread Sterling Smith
Mads, I recommend trying a text object[1], with a transform which is a blended transform from a transform factory[2]. Also, you probably want the x coordinate in axes coordinates, with a left horizontal alignment. -Sterling [1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text

Re: [Matplotlib-users] Label for axhline

2012-11-28 Thread Mads Ipsen
Sterling, Thanks - I ended up adding an extra y-tick with minor=True. Something along these lines: # Add Fermi line y = self._bandstructure.fermiLevel() self._axes.axhline(y=y, linestyle=':') # Add Fermi tick tick = self._axes.set_yticks([y], minor=True)[0] tick.label1On = False tick.label2On