Re: legend not working with symcat [message #68519] |
Thu, 05 November 2009 01:24  |
maurya
Messages: 16 Registered: February 2009
|
Junior Member |
|
|
On 5 Nov, 05:48, wlandsman <wlands...@gmail.com> wrote:
> On Nov 4, 6:19 pm, David Fanning <da...@dfanning.com> wrote:
>
>> Wayne Landsman writes:
>>> That would be true if all users had symcat.pro in their !path. But
>>> in case there are some inexperienced users who don't have the Coyote
>>> library installed yet, I've slightly modified your update to
>>> legend.pro to only call symcat.pro for non-standard PSYM values.
>
>>> http://idlastro.gsfc.nasa.gov/ftp/pro/plot/legend.pro
>
>> The problem now is that LEGEND won't compile *unless* you
>> have SYMCAT in your path. :-(
>
> Well, I don't think compilation is a problem, e.g. the program
>
> pro test,dum
> if keyword_set(dum) then a = some_program(3) else print,'AOK'
> return
> end
>
> will run fine so long as one doesn't try to access Some_program().
>
> IDL> test
> % Compiled module: TEST.
> AOK
> IDL> test,1
> % Variable is undefined: SOME_PROGRAM.
> % Execution halted at: TEST 2 /Volumes/Apps_and_Docs/
> landsman/codev/test.pro
>
> (If I had added a compile_opt idl2 at the beginning, it would also
> know that SOME_PROGRAM is an underined function/procedure rather than
> a variable.)
> Similarly, legend.pro should now run fine without symcat.pro in one's !
> path, so long as one doesn't try to use a value of PSYM>=11.
>
> But I agree the more general question is difficult. Currently, I
> keep JHUAPL routines I need in a separate directory, and tell users to
> delete the directory if they have the entire JHUAPL library
> installed.
>
> --Wayne
Thanks David and Wayne,
Actually, n=10 was not the symbol number in my previous post. It is
maximum number of increment in the for loop. The suggestions given by
David is most useful. Now, the "legend.pro" is working for all the
symbols defined in the "symcat.pro" except 10. You can see one of the
following test. Here, I am using new "legend.pro" program given by
Wayne (http://idlastro.gsfc.nasa.gov/ftp/pro/plot/legend.pro). I have
removed the symbol number 10.
-------------------------------------------------------
pro legend_test
set_plot,'win'
window,0,xs=600,ys=800
n=47
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)
lines(where(lines eq 10)) = 1
item='p='+string(lines,format='(i2.2)')
print,lines
legend, item, psym=lines
stop
end
------------------------------------------------------------ -
Cheers
|
|
|