What the best way to to use data coordinates rather than axes coordinates for xmin and xmax with axhline?
Here's my kludgy solution, but it's not elegant:
plot(arange(20))
ax = gca()
inv = ax.transAxes.inverted()
x = inv.transform(ax.transData.transform([10,0]))
ax.axhline(10, xmax=x[0])
I tried doing this:
ax.axhline(15, xmax=15, transform=ax.transData)
but I get:
ValueError: 'transform' is not allowed as a kwarg;axhline generates its own transform.
which is a bit strange since transform is listed in the kwargs in the help, though there is also this:
Valid kwargs are :class:`~matplotlib.lines.Line2D` properties,
with the exception of 'transform':
which could have two meanings: one is that all the kwargs listed are Line2D properties except 'transform' which is a valid kwarg, but not a Line2D property, OR even though 'transform' is listed, it's not a valid kwarg. Somewhat confusing especially given the ValueError...
M