Line collections vs a collection of lines

From: Eric Firing [mailto:efiring@…202…]

[snip]

It probably comes down to program simplicity and readability,
not speed, in your case.

Eric

Hi Eric,

Thanks for this. That's essentially the decision I had reached, but I
was also wondering if I'd missed something significant. I think I will
code it up as-is right now, and if the routine is unacceptably slow
re-examine it with an eye to shifting over to using line-collections.

In the same vein, if I need to refactor, is there any benefit to
treating single series as a collection with only one segment? I would
rather treat single series and multiple series in the same manner --
either plotting single series and multiple single-series or plotting
single-series collections and multiple-series collections. That is, I'd
rather not have to treat plotting a single series in one manner and
multiple series in another.

Thanks,
Anthony.

···

-----Original Message-----

Anthony M. Floyd wrote:

From: Eric Firing [mailto:efiring@…202…]

[snip]

It probably comes down to program simplicity and readability, not speed, in your case.

Eric

Hi Eric,

Thanks for this. That's essentially the decision I had reached, but I
was also wondering if I'd missed something significant. I think I will
code it up as-is right now, and if the routine is unacceptably slow
re-examine it with an eye to shifting over to using line-collections.

In the same vein, if I need to refactor, is there any benefit to
treating single series as a collection with only one segment? I would
rather treat single series and multiple series in the same manner --
either plotting single series and multiple single-series or plotting
single-series collections and multiple-series collections. That is, I'd
rather not have to treat plotting a single series in one manner and
multiple series in another.

A collection with only one member should work fine, although I don't know whether it has been explicitly tested. So, I don't see any reason why you should have to treat a single series as a special case.

Are you aware that the plot method can plot the columns of 2-D arrays? Any kwargs apply to all the lines. When plot does this, it makes a list of lines, not a line collection, so it is similar to looping over a set of single plot commands. There is no particular speed advantage, but it is nice and concise, if it yields what you actually want.

Eric

···

-----Original Message-----

Thanks,
Anthony.