From: Friedrich R. <fri...@gm...> - 2010-03-18 22:01:18
|
2010/3/4 Timo Heine <tim...@gm...>: > Basically what I want to do is to draw a horizontal line with relative y > co-ordinates and absolute xmin and xmax co-ordinate. Then I could draw a > line when a bit is high and have it always in plot area even when zooming > etc. Like axhline(...) but with relative y and absolute x > co-ordinates. I found a better solution candidate now, but I don't know whether it works: import matplotlib.transforms import matplotlib.lines <create Axes instance by calling fig.add_axes() or fig.add_subplot()> trans = matplotlib.transforms.blended_transform_factory(axes.transData, axes.transAxes) line = matplotlib.lines.Line2D([xmin, xmax], [yrel, yrel], transform = trans, <whatever like color = 'r'>) line.y_isdata = False axes.add_line(line) The code is taken from axes.py:Axes.axhline() with some alterations. Friedrich |