[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do polar plots with logarithmic axis in radial coordinate?



Thanks, I diddled with this all day and finally came up with something
reasonable that I hate but I'll post it in case anyone can improve on it.
Basically it takes the log10 of the data if the dynamic range is greater
than an order of magnitude, and call a special tick marking routine that
just plots the positive exponents on the positive x axis.

if(ffc) then abc=phz_fnc_ffc else abc=phz_fnc
abc=[reverse(abc(1:n_elements(abc)-1)),abc]
if (max(abc)/min(abc)) gt 10 then xpn_flg=1 else xpn_flg=0; Plot data by exponent
if xpn_flg then begin
	scl_xpn=abs(floor(min(alog10(abc))))+1
	print,'scl_xpn = ',scl_xpn
	scl=10.0^scl_xpn
	abc=alog10(scl*abc)
endif; endif xpn_flg
abc_min=min(abc)
abc_max=max(abc)
rng_x=[abc_min,abc_max]
rng_x=[-abc_max,abc_max]
ord=ngl_dgr*!pi/180.0
ord=[-1.0*reverse(ord(1:n_elements(ord)-1)),ord]
ord_min=min(ord)
ord_max=max(ord)
rng_y=[ord_min,ord_max]
rng_y=rng_x
if prn then chr_sz=2.0 else chr_sz=1
ttl=string(aer_lng_nm)
x_ttl=''
y_ttl='!5Scattering Angle !7H!5 (radians)'

if prn then begin
	mrg_top=0.6 ; 2 is default
	if top then mrg_top=mrg_top+1.1
	mrg_btm=0.5 ; 4 is default
	if btm then mrg_btm=mrg_btm+2.7
	if not top then ttl=''
	if not btm then x_ttl=''
	fl_nm_out='/data/zender/ps/phz_fnc_plr.ps'
	open_ps,fl_nm=fl_nm_out,x_sz=x_sz,y_sz=y_sz,/ps,/color
endif; endif prn

; polar plot phz_fnc
print,'abc = ',abc
print,'abc_min = ',abc_min,', abc_max = ',abc_max
xlg_flg=0
ylg_flg=0
plot,abc,ord,xlog=xlg_flg,ylog=ylg_flg,tit=ttl,xtit=x_ttl,xrange=rng_x,yrange=rng_y,xmargin=[mrg_lft,mrg_rgt],ymargin=[mrg_btm,mrg_top],xstyle=5,ystyle=5,thick=2.0,charsize=chr_sz,linestyle=0,color=clr_blk_idx,/nodata,/polar,psym=2,position=aspect(1.0)
oplot,abc,ord,max_value=1.0e20,thick=2.0,linestyle=0,color=clr_blk_idx,/polar
if xpn_flg then tck_fmt_fnc='plr_tck_fmt' else tck_fmt_fnc='pst_tck_fmt'
axis,0.0,0.0,xaxis=0,xlog=0,xtick_get=x_tck,xstyle=1,charsize=0.75*chr_sz,color=clr_blk_idx,xtickformat=tck_fmt_fnc ; IDL 3.6 UG p. 14-24
axis,0.0,0.0,yaxis=0,ylog=0,ytick_get=y_tck,ystyle=1,charsize=0.75*chr_sz,color=clr_blk_idx,ytickformat='null_fmt' ; IDL 3.6 UG p. 14-24

; Draw circles
max_dat=max(abc)
for idx=0,n_elements(x_tck)-1 do begin
	crc_val=circle(0,0,x_tck(idx))
	if idx ne 0 then plots,crc_val,color=2
endfor; end loop over tck

if info then begin
ln_lgn_x1=0.07
ln_lgn_dx=0.07
ln_lgn_x2=ln_lgn_x1+ln_lgn_dx
txt_lgn_x=ln_lgn_x2+0.01
txt_lgn_sz=1.75
lgn_y_top=0.77
lgn_dy=0.05
lgn_y=lgn_y_top-indgen(6)*lgn_dy
if xpn_flg then xyouts,txt_lgn_x+0.45,0.22,'!5log!I10!N[10!E'+auto_sng(scl_xpn,0)+'!N!8p!5(!7H!5)!5]',color=clr_blk_idx,size=0.75*chr_sz,/NORMAL
xyouts,txt_lgn_x+0.45,lgn_y(0),'!7k!5 = '+auto_sng(wvl_dbg*1.0e6,2)+' !7l!5m',color=clr_blk_idx,size=0.75*chr_sz,/NORMAL
if ffc then xyouts,txt_lgn_x,lgn_y(0),'!8D!5!Inmr!N = '+auto_sng(dmt_nmr*1.0e6,2)+' !7l!5m',color=clr_blk_idx,size=0.75*chr_sz,/NORMAL
if ffc then xyouts,txt_lgn_x,lgn_y(1),'!7r!5 = '+auto_sng(psd_gsd_anl,2),color=clr_blk_idx,size=0.75*chr_sz,/NORMAL
if not ffc then xyouts,txt_lgn_x,lgn_y(0),'!8D!5 = '+auto_sng(dmt_dbg*1.0e6,2)+' !7l!5m',color=clr_blk_idx,size=0.75*chr_sz,/NORMAL
endif; endif info

if prn then close_ps,fl_nm=fl_nm_out else begin
print,'Hit any key to continue, or q to quit ...'
foo=get_kbrd(1)
if foo eq 'q' then goto,end_of_procedure
endelse; endif not prn




-- 
Charlie Zender zender@uci.edu (949) 824-2987/FAX-3256, Department of
Earth System Science, University of California, Irvine CA 92697-3100