print, 'Output Medium: ' print, ' ' print, ' output.ps (0)' print, ' output.eps (1)' print, ' Tektronix-Screen (2)' print, ' X-Screen (3)' print, ' Windows (4)' print, ' terminate program (5)' ;read, medium medium = 0 case medium of 0: begin set_plot, 'PS' device, filename='lh.ps', $ /landscape, $ xoffset=2.5, yoffset=26., $ xsize=24., ysize=16. ; /portrait, $ ; xoffset=2., yoffset=3., $ ; xsize=16., ysize=24. end 1: begin set_plot, 'PS' device, filename='lh.eps', $ /encapsulated, $ xsize=24., ysize=16. end 2: begin set_plot, 'TEK' end 3: begin set_plot, 'X' ; window, 0, xsize=650.*210/297, ysize=650. ; !p.color=255 ; !p.background=0 end 4: begin set_plot, 'WIN' ; window, 0, xsize=600., ysize=400. ; !p.color=255 ; !p.background=0 end else: begin print, 'Program terminated' stop end endcase xyouts, 0.5, 0.5, /normal, '!5' ; set font to font-no.5 !x.thick = 3.0 !y.thick = 3.0 !p.charsize = 1.5 !p.charthick = 2.0 fn = ' ' dummy = ' ' ; declare fn and dummy as string var. ; if you don't declare a var., IDL will ; assume, that var. is a float number ln = long(0.0) ; declare ln as long integer ;print, 'enter file name: ' ;read, fn ; read from standard input fn = 'lh87.dat' openr, 1, fn ; open file with handle 1 for reading while not eof(1) do begin readf, 1, dummy ; reads until end of line ln = ln + 1 ; count lines in file endwhile close, 1 ; close file ;print, 'enter number of columns: ' ;read, col ; tell prog no. of columns in data file col = 7 dat = dblarr(col, ln) ; declare 2-dim. array for data storing openr, 1, fn readf, 1, dat ; read all data in file into array close, 1 !p.multi = [0, 1, 2, 0, 0] !p.region = [0.0, 0., 0.5, 1.] plot_oi, dat[2,*], dat[0,*], $ position = [0., 0., 0.5, 1.], $ xtitle = 'Density [g cm!U-3!N]', $ ytitle = 'Altitude [km]', $ ystyle = 1, $ ; style = 3 => extend axis exactly 5% in each direction. xstyle = 3 ; The '$'-sign means: the next line is actually ; part of the current line oplot, dat[1,*], dat[0,*], linestyle = 1 oplot, dat[3,*], dat[0,*], linestyle = 1 xmax = max([dat[5,*], dat[4,*], dat[6,*]]) xmin = min([dat[5,*], dat[4,*], dat[6,*]]) !p.region = [0.5, 0., 1., 1.] plot, dat[5,*], dat[0,*], $ position = [0.5, 0., 1., 1.], $ xrange = [xmin, xmax], $ ytitle = ' ', $ ytickname = replicate(' ', 30), $ xtitle = 'Temperature [K]', $ ystyle = 1, $ ; style = 3 => extend axis exactly 5% in each direction. xstyle = 3 ; The '$'-sign means: the next line is actually ; part of the current line oplot, dat[4,*], dat[0,*], linestyle = 1 oplot, dat[6,*], dat[0,*], linestyle = 1 if (medium eq 0 or medium eq 1) then begin device, /close ; close 'output.ps' print, 'Rename "output.ps" or "output.eps" before you call this program again !!' endif end