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

Home » Public Forums » archive » Re: legend not working with symcat
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: legend not working with symcat [message #68544 is a reply to message #68541] Wed, 04 November 2009 01:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
maurya writes:

> The routine 'legend' is not working with the function 'symcat' for
> the following test program.
>
> ;;;;;;;;;===============================
> pro legend_test
>
> set_plot,'win'
>
> window,0,xs=600,ys=500
>
> n=12
> xx=findgen(200)
> for i=0,n-1 do begin
> ii=i+1
> yy=sin(xx*!dtor*ii*0.2)
> if (i eq 0) then plot,yy,yr=[0,1.1],psym=symcat(i),/yst $
> else oplot,yy,psym=symcat(i),symsize=0.6,nsum=2
> endfor
>
> lines=indgen(n)
> item='p='+string(lines,format='(i2.2)')
> legend,item,psym=symcat(lines)
>
>
> stop
> end
> ;;;;;;;;;;;;================================================ ======
>
> Can anyone help.

Probably not. The problem is that SymCat is not "vectorized"
in this way, and with good reason. Most of the symbols SymCat
creates have to be built one-at-a-time with USERSYM. Then
selected with the symbol index 8. So, if it was vectorized,
you would certainly end up with a vector filled mostly with
8's.

IDL> symbols = IntArr(10)
IDL> FOR j=0,9 DO symbols[j] = SymCat(j + 10)
IDL> Print, symbols
10 8 8 8 8 8 8 8 8 8

In other words, the symbol created by USERSYM is "ephemeral"
and can only be used for a short time. Well, until the *next*
symbol is defined.

The only way to fix this, as far as I can tell, would be
to modify legend.pro to call SymCat whenever is creates a
symbol.

On lines 425-427, in which PLOTS is being used
to draw the symbol in the legend with PSYM, I changed
"psym=psym[i]" to "psym=SymCat(psym[i]" and I changed
your example program call from this:

legend, item, psym=SymCat(lines)

To this:

legend, item, psym=lines

And all works as you expect.

Wayne would have to confirm that this is the only place a change
would have to be made. But I think he could add this to legend
and gain access to 35 more symbols then he has now and not be
worried by backward compatibility at all. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ENVI + IDL
Next Topic: Plot single data points in IMAP

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

Current Time: Sun Oct 12 00:03:52 PDT 2025

Total time taken to generate the page: 8.63977 seconds