On Tue, Dec 16, 2008 at 10:30 AM, John Hunter <jdh2...@gmail.com> wrote:

>> using in favour of matplotlib). Plotting the data twice- the first time
>> without
>> symbol showing every data point and the second time onlywith the symbol
>> and some skip in the data - doesn't help as I now get two entities in
>> the legend.
>
> There is a way to do this, but it is not terribly elegant.  The tricky
> part is to get the legend right::

I just added a new line property called "markevery" to support
subsampling markers.  Included below is the docstring and nosetest
which should clearly indicate usage:

    def set_markevery(self, every):
        """
        Set the markevery property to subsample the plot when using
        markers.  Eg if ``markevery=5``, every 5-th marker will be
        plotted.  *every* can be

        None
            Every point will be plotted

        an integer N
            Every N-th marker will be plotted starting with marker 0

        A length-2 tuple of integers
            every=(start, N) will start at point start and plot every
N-th marker


        ACCEPTS: None | integer | (startind, stride)

        """


def test_markevery():
    x, y = np.random.rand(2, 100)

    # check marker only plot
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, 'o')
    ax.plot(x, y, 'd', markevery=None)
    ax.plot(x, y, 's', markevery=10)
    ax.plot(x, y, '+', markevery=(5, 20))
    fig.canvas.draw()
    plt.close(fig)

    # check line/marker combos
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x, y, '-o')
    ax.plot(x, y, '-d', markevery=None)
    ax.plot(x, y, '-s', markevery=10)
    ax.plot(x, y, '-+', markevery=(5, 20))
    fig.canvas.draw()
    plt.close(fig)

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to