comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Slow object graphics when plotting multiple lines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Slow object graphics when plotting multiple lines [message #92974 is a reply to message #92973] Mon, 04 April 2016 09:50 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 4 April 2016 17:54:03 UTC+2, alx wrote:

>> Other, similar, tools don't have these issues. (Yes, I mean matlab).

> As far as I understand, the function PLOT(/OVERPLOT) was NOT designed as being a simple overplotting routine. When you add a new curve, the entire plot is actually modified (ranges, axes, etc...) at the expense of some slowness. I guess that it is a feature from Exelis.

Yes, this "feature" makes this approach O(N^2), which scales terribly beyond a couple of hundred lines. I don't see why the view needs to be recalculated for each new object, at least not by default.

Though this use is not really what you should do in IDL anyway since the overhead created by the loop itself makes even direct graphics slow when then number of lines becomes large (> 10000 or so).

> If you want to do a "simple" overplotting (ala OPLOT), an efficient way is to combine POSITION, CURRENT and [XYZ]RANGE keywords, instead of using OVERPLOT.

How? The documentation of PLOT() indicates something else (unless I misunderstood you):

******************
OVERPLOT
Set this keyword to 1 (one) to place the graphic on top of the currently-selected graphic within the current window. The two graphics items will then share the same set of axes. If no current window exists, then this keyword is ignored and a new window is created.
[...]
Tip: If you want your graphic to have a new set of axes, you should use the CURRENT keyword instead.

CURRENT
Set this keyword to create the graphic in the current window with a new set of axes. If no window exists, a new window is created.
[...]
Tip: If you want your graphic to share the same axes as an existing graphic, you should use the OVERPLOT keyword instead.
******************

I think it should be possible to do something like

p = PLOT(randn(seed,num_ points, num_lines))

and get what you want without jumping through the hoops involved in constructing the CONNECTIVITY matrix or adding fake missing data (NaN) to make it work. I don't see why not. PLOT() currently takes a vector as input, and if you try to apply it to a 2D array, it will flatten to a 1D array first. The latter property is _not_ documented, so the Harris people could easily add this functionality. It should be <10 lines of code. It would make the life easier for simple cases like this where all the curves have the same number of points.

> The POLYLINE trick, when many curves are needed, looks like to me somewhat faster than Matlab or Python equivalents.

Indeed. And, as I showed, nearly as fast as direct graphics for large number of lines. Which is quite impressive!

POLYLINE is of course still very useful when plotting lots of curves with different number of points, e.g. a map.

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: JSON file manipulation in idl
Next Topic: How to create an image with more than one gaussian psfs?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:35:51 PDT 2025

Total time taken to generate the page: 0.00369 seconds