; This was originally mktraj01sm to make the arXiv version
; of Fig. 7 from Weeks & Criddle PRE 2020.
;
; The original version of this figure (as published)
; plots all of the trajectory data.  The arXiv version plots every
; 10th point, thus reducing the file size significantly.


filename='~/fig04'
sp,1
device,file=filename+'.eps'
device,/color
loadct,76,file='~weeks/ericcol.tbl'
pfontold=!P.FONT
!P.FONT=1
device,set_font='Times',/tt_font


col6=21; reddish purple
col5=42; red
col4=160; green
col3=187; light blue/green
col2=216; dark blue
col1=255; dark purple

; ===============================BEGIN PLOTTING BELOW


x1=0.1
y1=0.7
x2=0.8
y2=0.9
xr=[0,2e4]
dy=0.25
yr=[-20,20]



b=" "
bl=[b,b,b,b,b]
yt=ktex2idl('$c$_1')
cs=1.5
yout=12
xout=0.3e3


plot,time30,s30,pos=[x1,y1,x2,y2],xr=xr,xtickn=bl, $
  ytitle=yt,/nodata,yr=yr,chars=cs,yminor=2
oplot,time30,s30,color=col5
xyouts,xout,yout,ktex2idl('(a) $\epsilon$=0.3'),chars=cs*0.8
; epsilon = 0.3:  lifetime = 290
; I see 42 transitions, should be 69, and 42 = (2/3)*69 roughly


plot,time20,s20,pos=[x1,y1-dy,x2,y2-dy],xr=xr,/noerase,xtickn=bl, $
  ytitle=yt,/nodata,yr=yr,chars=cs,yminor=2
oplot,time20,s20,color=col2
xyouts,xout,yout,ktex2idl('(b) $\epsilon$=0.2'),chars=cs*0.8
; epsilon = 0.2:  lifetime = 650
; I see 18 transitions, should be 31, and 18 = (2/3)*31 roughly

plot,time10,s10,pos=[x1,y1-dy*2,x2,y2-dy*2],xr=xr,/noerase, $
  ytitle=yt,/nodata,yr=yr,chars=cs,yminor=2, $
  xtitle=ktex2idl('time ($\tau$_B)')
oplot,time10,s10,color=col1
xyouts,xout,yout,ktex2idl('(c) $\epsilon$=0.1'),chars=cs*0.8
; epsilon = 0.1:  lifetime = 11000
; There are 2 transitions, should be 1.8*(2/3) = 1.2 transitions

; ===============================END PLOTTING ABOVE

!P.FONT=pfontold

device,/close
sp,3

spawn,'~weeks/bin/bbox_add.pl '+filename+'.eps'
spawn,'~weeks/bin/pagebbox.sh '+filename+'.eps'

; next few lines are to make a JPEG file in case you want to use
; it in powerpoint.  You can change -xsize=900 to change the
; resolution of the JPEG.
spawn,'pstopnm -portrait -stdout -xsize=900 '+filename $
   +'.eps > blah.ppm'
spawn,'pnmtojpeg -quality=95 blah.ppm > '+filename+'.jpg'
spawn,'rm blah.ppm'
cropjpg,filename+'.jpg'

; load in the JPEG and display it, just for fun:
read_jpeg,filename+'.jpg',tmp

; this is to shrink the image, if needed
tmp1=small(reform(tmp(0,*,*)))
nx=n_elements(tmp1(*,0))
ny=n_elements(tmp1(0,*))
tmp4=bytarr(3,nx,ny)
tmp4(0,*,*)=tmp1
tmp4(1,*,*)=small(reform(tmp(1,*,*)))
tmp4(2,*,*)=small(reform(tmp(2,*,*)))

erase
tv,tmp,true=1    ; fullsize image
;tv,tmp4,true=1   ; halfsize image

