Viewing contents of file '../idllib/user_contrib/knight/legendtest.pro'
;+
; Name:
; legendtest
; Purpose:
; Test the legend procedure.
; Usage:
; .run legendtest
; Inputs:
; none
; Optional Inputs:
; none
; Keywords:
; none
; Outputs:
; legends of note
; Common blocks:
; none
; Procedure:
; Side Effects:
; Sets !20 font to symbol if PostScript and !p.font=0.
; Restrictions:
; With the vectorfont test, you'll get different results for PostScript
; depending on the value of !p.font.
; Modification history:
; write, 27 Aug 92, F.K.Knight (knight@ll.mit.edu)
;-
if (!d.name eq 'PS') and (!p.font eq 0) then device,/Symbol,font_index=20
items = ['diamond','asterisk','square']
psym = [4,2,6]
lineitems = ['solid','dotted','DASHED']
linestyle = [0,1,2]
citems = 'color '+strtrim(string(indgen(8)),2)
colors = 15*indgen(8)+50
z = ['legend,items,psym=[4,2,6]' $
,'legend,lineitems,linestyle=linestyle' $
,'legend,items,psym=psym,/horizontal,chars=1.5 ; horizontal format' $
,'legend,[items,lineitems],psym=[psym,0,0,0],line=[0,0,0,linestyle],box=0 ; sans border' $
,'legend,items,psym=psym,margin=1,spacing=2,char=2,delimiter="="; delimiter & larger margin' $
,'legend,lineitems,line=linestyle,pos=[.3,.5],char=3,number=4 ; position of legend' $
,'legend,items,psym=-psym,number=2,line=linestyle; plot two symbols, not one' $
,'legend,citems,/fill,psym=8+intarr(8),colors=colors,char=2; 3 filled squares' $
,'legend,[citems(0:4),lineitems],/fill,psym=[8+intarr(5),0*psym],line=[intarr(5),linestyle],colors=colors,char=2; 3 filled squares' $
,"legend,['Absurd','Sun Lover','Lucky Lady','Fishtail Palm'],vector=['ab!9r!3','!9nu!3','!9Wf!3','!9cN!20K!3'],charsize=2,pos=[.1,.5],psp=3" $
]
prompt = 'Hit return to continue:'
for i = 0,n_elements(z) - 1 do begin
erase
stat = execute(z(i))
xyouts,.01,.15,'COMMAND TO MAKE LEGEND:',charsize=1.7,/norm
xyouts,.01,.05,z(i),/norm,charsize=1.2
print,prompt,format='($,a)'
a = get_kbrd(1)
print
endfor
erase
!p.charsize=2
c1_items = ['Plus','Asterick','Period','Diamond','Triangle','Square','X']
c1_psym = indgen(7)+1
c2_items = ['Solid','Dotted','Dashed','Dash Dot','Dash Dot Dot Dot','Long Dashes']
c2_line = indgen(6)
legend,c1_items,psym=c1_psym,corners=c1,box=0
legend,c2_items,line=c2_line,corners=c2,box=0,pos=[c1(2),c1(3)]
c = [c1(0)<c2(0),c1(1)<c2(1),c1(2)>c2(2),c1(3)>c2(3)]
plots,[c(0),c(0),c(2),c(2),c(0)],[c(1),c(3),c(3),c(1),c(1)],/norm
!p.charsize=0
xyouts,.01,.05,'Multiple columns---type "legend,/help" for details.',/norm,charsize=1.2
end