[ANN] basemap matplotlib toolkit 0.1.1

For example, if I have a data set that looks like this:

    > [155,2] [165,4] [175,6] [-175,8] [-165,10] [-155,12]

    > I really need this data to be drawn as two separate lines:
    > [155,2] [165,4] [175,6] [180,7]

    > and [-180,7] [-175,8] [-165,10] [-155,12]

    > Ideally these two segments should be treated as a single line
    > wherever applicable (legend, style, etc).

Got it -- what comes immediately to mind is for you to create a new
class derived from Line2D, that contains your 2...N lines as private
attrs, defines __getattr__ to return the attr of line[0], and calls
the Line2D parent setattr on each of your contained line instances.
You can then add this line to the Axes with add_line.

You would have to be a little clever with the get_xdata and get_ydata
attrs, which are used for autoscaling. If this looks like a good way
to go, I can help you with it if you want - it could be tricky to get
just right.

The other possibility would be to setup an observer pattern on the
line0 properties, such that any changes would be fired off to the
observers. This is an area where it would be nice to have enthought
traits built-in, since all trains support observers. As you may have
noticed on the dev list, this is an area of active discussion.

    > I'd probably label this as a "mostly acceptable work-around"
    > since it requires generating two data arrays. In my case,
    > the data is expensive to compute so we'd probably have to
    > generate a second array by selectively copying points from
    > the first array which is kind of annoying. I was hoping for
    > a keyword that said how often to generate the markers for an
    > existing line (with the default as one of course). Probably
    > not a huge deal though.

If this becomes a performance problem for you, another idea would be
to use a marker mask. Eg add an additional property to the line class
which are the indices at which to write markers.

Currently the line class is hairy in CVS, mainly because it is
supporting the old and newstyle backend drawing interfaces. The
newstyle interface has only two renderer methods that it calls
(draw_lines and draw_markers). It would be fairly easy to subclass
Line2D to support a marker mask, possibly passing it on as a kwarg to
the renderer.draw_markers method. One could do it in Numeric a the
python level; if you are looking for optimal performance, it would be
barely more than a no-op at the backend level.

JDH

Thanks for all the advice! We're going to start working on this ground track plotting package in the March-April time frame so I'm going to save off these notes for the implementor. We'll let you know if we need any more help then.

Thanks,
Ted

···

At 01:25 PM 2/11/2005, John Hunter wrote:

    > For example, if I have a data set that looks like this:

    > [155,2] [165,4] [175,6] [-175,8] [-165,10] [-155,12]

    > I really need this data to be drawn as two separate lines:
    > [155,2] [165,4] [175,6] [180,7]

    > and [-180,7] [-175,8] [-165,10] [-155,12]

    > Ideally these two segments should be treated as a single line
    > wherever applicable (legend, style, etc).

Got it -- what comes immediately to mind is for you to create a new
class derived from Line2D, that contains your 2...N lines as private
attrs, defines __getattr__ to return the attr of line[0], and calls
the Line2D parent setattr on each of your contained line instances.
You can then add this line to the Axes with add_line.

You would have to be a little clever with the get_xdata and get_ydata
attrs, which are used for autoscaling. If this looks like a good way
to go, I can help you with it if you want - it could be tricky to get
just right.

The other possibility would be to setup an observer pattern on the
line0 properties, such that any changes would be fired off to the
observers. This is an area where it would be nice to have enthought
traits built-in, since all trains support observers. As you may have
noticed on the dev list, this is an area of active discussion.

    > I'd probably label this as a "mostly acceptable work-around"
    > since it requires generating two data arrays. In my case,
    > the data is expensive to compute so we'd probably have to
    > generate a second array by selectively copying points from
    > the first array which is kind of annoying. I was hoping for
    > a keyword that said how often to generate the markers for an
    > existing line (with the default as one of course). Probably
    > not a huge deal though.

If this becomes a performance problem for you, another idea would be
to use a marker mask. Eg add an additional property to the line class
which are the indices at which to write markers.

Currently the line class is hairy in CVS, mainly because it is
supporting the old and newstyle backend drawing interfaces. The
newstyle interface has only two renderer methods that it calls
(draw_lines and draw_markers). It would be fairly easy to subclass
Line2D to support a marker mask, possibly passing it on as a kwarg to
the renderer.draw_markers method. One could do it in Numeric a the
python level; if you are looking for optimal performance, it would be
barely more than a no-op at the backend level.

JDH

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Ted Drain Jet Propulsion Laboratory ted.drain@...369...