Re: cgwindow and cgplot, bug? [message #80971] |
Fri, 27 July 2012 05:29  |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den fredagen den 27:e juli 2012 kl. 14:13:32 UTC+2 skrev David Fanning:
> 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
Ah, a little more attention is required when fixing up some older code.
Thanks and sorry about the noise!
/Mats
|
|
|