On Fri, Jun 27, 2008 at 2:56 PM, Angus McMorland <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I sometimes find myself wanting to plot a series of lines using
> axhline or axvline. Is there a mechanism to do this that I'm missing,
> or would it be difficult to support the positional parameter being an
> array of values at which to draw each line?
>

You could use a line collection with the right transform

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import matplotlib.collections as collections

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(10))


trans = mtransforms.blended_transform_factory(
            ax.axes.transData, ax.axes.transAxes)
coll = collections.LineCollection([((x, 0), (x, 1)) for x in
10*np.random.rand(20)],
                                  transform=trans, color='red', lw=2, alpha=0.5)
ax.add_collection(coll)

plt.show()

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to