
;+
;  This tests working with image data and using a contour.
;  The text label shows how the latex formatting works and how a
;  different font can be set.
;-

gauss = GAUSSIAN_FUNCTION([5,4], WIDTH=[30,25], MAXIMUM=5)

s=size(gauss,/dim)
nx=s[0]
ny=s[1]
x=findgen(nx)
y=findgen(ny)

bgcolor='black'
color='white'

w=window(dim=[600,500],background_color=bgcolor)

p=image(gauss,x,y,/current, $
        xcolor=color, $
        ycolor=color, $
        axis_style=2, $
        rgb_table=5, $
        xthick=th, $
        ythick=th, $
        position=[0.12,0.12,0.84,0.84], $
        font_size=fs, $
        xticklen=0.015, $
        yticklen=0.015)

;
; Note the X and Y vectors have to be adjusted to make the contour
; correctly line up with the image (!).
; 
pc=contour(gauss,x+0.5,y+0.5,color='pink',/overplot, $
           c_thick=th, $
           n_levels=4, $
           font_size=fs)

ct1=colorbar(target=p, $
             position=[0.12,0.92,0.84,0.96], $
             thick=th, $
             color=color, $
             font_size=fs, $
             /border)

ct2=colorbar(target=p, $
             position=[0.92,0.12,0.96,0.84], $
             orientation=1, $
             thick=th, $
             color=color, $
             font_size=fs, $
             /border)

lbl=text(/data,2,2,'$a exp(-(x-x_0)^2/2\sigma^2)$',font_size=fs+2,color=color, $
         font_name='Times', font_style='bold italic')

w.save,'exercise5.png',resolution=97

END
