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

Home » Public Forums » archive » Re: Using SYMCAT with LEGEND
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Using SYMCAT with LEGEND [message #56489] Thu, 25 October 2007 22:10 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
willettk@gmail.com writes:

> When I execute this, however, LEGEND plots all three datasets as
> filled circles (SYMCAT(16)), when it should go [filled diamond, filled
> square, filled circle]. There are ways around this (making my own
> legend by hand, for a start), but I'd like to know if anyone has a
> quick solution for making these two programs work with each other.

OK, to make this work, I commented out lines 411 and 412:

; if (psym[I] eq 8) and (N_elements(usersym) GT 1) then $
; usersym,usersym,fill=fill,color=colors[I]

This means you won't be able to specify your own symbol in
legend anymore. (Why would you need to if you are using
SYMCAT!?)

Then, on line 422 I found the PSYM keyword and changed
it from "psym=psym[I]" to "psym=SYMCAT(psym[I])".

Done.

Then, I tried this:

IDL> items = ['Filled Square', 'Hourglass', 'Filled Star']
IDL> sym = [15, 21, 46]
IDL> Legend, items, PSYM=sym

For a quick and dirty solution, it's not so bad. :-)

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.")
Re: Using SYMCAT with LEGEND [message #56494 is a reply to message #56489] Thu, 25 October 2007 16:07 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
willettk@gmail.com writes:

> I have a small problem using two programs that are pretty much
> everyday for me when I'm plotting in IDL; David's excellent SYMCAT
> program and the LEGEND program in the Goddard astro library. The
> problem is that, when trying to put my user defined symbols in the
> legend, it will display the _last_ symbol used for all of my user-
> defined symbols using SYMCAT.
>
> For example, say I'm scatter plotting three data sets with a legend:
>
> ;;
>
> x1 = findgen(10) & x2 = findgen(10)*2 & x3 = findgen(10)/2
> y1 = x1 & y2 = x2 & y3 = x3
>
> plot, x1, y1, psym = symcat(14)
> oplot,x2, y2, psym = symcat(15)
> oplot,x3, y3, psym = symcat(16)
>
> legend, ['Data1','Data2','Data3'],
> psym=[symcat(14),symcat(15),symcat(16)], /top, /right
>
> ;;
>
> When I execute this, however, LEGEND plots all three datasets as
> filled circles (SYMCAT(16)), when it should go [filled diamond, filled
> square, filled circle]. There are ways around this (making my own
> legend by hand, for a start), but I'd like to know if anyone has a
> quick solution for making these two programs work with each other.

The problem, I'm afraid, is that SYMCAT nearly *always*
returns a value of 8. That is, a user-defined symbol.
And only one user-defined symbol can be loaded at any
time in IDL.

I think the LEGEND command might need to be modified
so that it could call SYMCAT directly with numbers that
are supplied to it. It would probably be more complicated
than this, but in the LEGEND code, if the value of PSYM
was GE 8 THEN use SYMCAT to provide the value, otherwise,
do what you are doing now. Since this *should* be
compatible with values you are now using for LEGEND,
you might be able to just change any PSYM=??? code
in LEGEND with PSYM=SYMCAT(???) and things might work normally.

I'm not in the position to check it right now, since
game two of the World Series is about to begin. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Using SYMCAT with LEGEND [message #56573 is a reply to message #56489] Fri, 26 October 2007 13:32 Go to previous message
willettk is currently offline  willettk
Messages: 20
Registered: October 2006
Junior Member
That'll do just fine for quick and dirty. Thanks, David.

Perhaps at 5280 ft., the Rockies will find their stroke again.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: cursor,xi,yi/device
Next Topic: Computer Security Information

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

Current Time: Sat Oct 11 16:47:33 PDT 2025

Total time taken to generate the page: 1.68232 seconds