Mats Löfdahl writes:
> I just noticed a possible bug in cgwindow/cgplot. Here is a minimal example.
>
> The following lines make a plot with two data points represented as squares:
>
> cgwindow, /free
> cgplot,/add,[1,2],[2,1], psym=symcat(6),xrange=[0,5],yrange=[0,5]
>
> If I add the following line:
>
> cgplot,/add,/over,[1,2],[3,2], psym=symcat(9)
>
> I get two more points as circles as expected - AND the two points from the first cgplot call are ALSO turned into circles! I've updated the coyote library (five minutes ago) but the problem persists.
>
> In a cgdisplay window and without the /add keyword, the plot comes out as expected.
Yes, this is because keyword values are hard-coded when
they are added to the cgWindow. When you say PSYM=SymCat(6),
whatever SymCat(6) evaluates to is stored as the PSYM
keyword. In this case, (in almost *every* case!) that
value is 8. That happens to be the same value as
SymCat(9).
But, the solution is simple. Don't use SYMCAT here!!!
If you don't use it, then the symbol value is NOT
hard-coded, but is evaluated at the time the
cgPlot command is executed.
This problem is a result of writing the commands
incorrectly. The proper way to write these commands
is like this:
cgWindow
cgPlot, /add,[1,2],[2,1], psym=6, xrange=[0,5], yrange=[0,5]
cgplot, /add, /over, [1,2],[3,2], psym=9
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|