
;+
; Plot exercise 2
;   - two Y-axes
;   - legend
;-

x=findgen(101)/100.*2.*!pi

bgcolor='white'
color='black'

w=window(dimension=[700,500],background_color=bgcolor)

th=2
fs=14

p=plot(x,sin(x), /current, $
       name='Sea level', $
       xcolor=color, $
       ycolor=color, $
       thick=th, $
       xthick=th, $
       ythick=th, $
       font_size=fs, $
       xstyle=1, $
       xtitle='Time / hours', $
       ytitle='Sea level / meters', $
       xminor=1, $
       xticklen=0.015, $
       yticklen=0.015, $
       position=[0.14,0.14,0.86,0.97])

;
; Gets rid of the current Y-axis.
;
ax=p.axes
ax[3].hide=1

q=plot(x,-sin(x), /overplot, $
       color='blue',thick=th, $
       name='Beach size')

l=legend(target=[p,q], $
         thick=th, $
         font_size=fs, $
         pos=[5.8,0.2], /data)

qy=axis('y', location='right', $
        coord_transform=[50,50],color='blue', $
        tickfont_size=fs,thick=th, $
        title='Beach area / m$^2$')

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

END
