; this was originally
; /data/eric/OLD/kingkong-eric/fernando-dr/190409data/mkbathmsd02
;
; to make msd-bath --> Fig. 4 from 
; Tapia-Ignacio, Moctezuma, Donado, & Weeks, PRE 102, 022902 (2020).


filename='~/fig02'
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

; cols=reform(rgb2_24(bw2rgb3(indgen(256))))
cols=indgen(256)

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


x1=0.1 & x2 = 0.4
y1=0.05 & dy=0.25
y2=y1+dy+0.03
y3=y2+dy+0.03
cs=2.0
b=" "
bb=[b,b,b,b,b]

la=ktex2idl('$\langle$')
ra=ktex2idl('$\rangle$')
yt1=la+ktex2idl('$\Delta \theta$^2')+ra

th=3

e=indgen(33)
yt3=la+ktex2idl('$\Delta{}r$^2_{bath}')+ra+ktex2idl(' (mm^2)')
plot,m25(0,e),m25(5,*),/xl,/yl,/nodata,yr=[0.1,1000],xr=[0.01,10.00], $
   ytitle=yt3,chars=cs,xtitle=ktex2idl('$\Delta{}t$ (s)')
cc=255 & dcc=-34
oplot,m25(0,e),m25(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m30(0,e),m30(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m35(0,e),m35(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m40(0,e),m40(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m45(0,e),m45(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m50(0,e),m50(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
oplot,m55(0,e),m55(5,*),color=cols(cc),l=0,thick=th  & cc+=dcc
;ver,0.1,lines=1,thick=2
oplot,[0.1,0.1],[0.5,5],lines=1,thick=5

bla=findgen(101)*0.0005+0.02
oplot,bla,(bla^1.70)*300,lines=2,thick=th
xyouts,0.03,1.0,orient=45,ktex2idl('\sim$\Delta{}t$^{1.7}'),chars=cs,/data
oplot,[0.3,4],[0.3,4]*60.,l=2,thick=th
xyouts,1.00,80.0,orient=30,ktex2idl('\sim$\Delta{}t$^{1.0}'),chars=cs,/data
bla2=findgen(150)*0.025+0.3
oplot,bla2,(bla2^0.80)*5,lines=2,thick=th
xyouts,1.00,2.0,orient=25,ktex2idl('\sim$\Delta{}t$^{0.8}'),chars=cs,/data

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


!P.FONT=pfontold

device,/close
sp,3

spawn,'bbox_add.pl '+filename+'.eps'
spawn,'pagebbox.sh '+filename+'.eps'
spawn,'pstopnm -portrait -stdout -xsize=900 '+filename $
   +'.eps > ~/blah.ppm'
spawn,'pnmtojpeg -quality=95 ~/blah.ppm > '+filename+'.jpg'
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

