* example: * v/read x,a,b,c data.txt * exec vplot x a b c * exec vplot x a b c xtitle='MeV' ytitle='Events' * exec vplot x a b c xtitle='MeV' ytitle='Events' xmin=0 xmax=2000.0 chopt=mc macro vplot xvec=0 yvec1=0 yvec2=0 yvec3=0 yvec4=0 yvec5=0 yvec6=0 yvec7=0 yvec8=0 chopt='' xtitle=* ytitle=* xmin=* xmax=* ymin=* ymax=* xkeypos=0.2 ykeypos=0.93 yvecerr1=0 if [yvec1]=0 then message 'usage: vplot x y [y2 [y3 [y4 ...]]] [chopt] [xtitle] [ytitle] [xmin] [xmax] [ymin] [ymax] [yvec1err]' message ' x,y... are vector names' message ' chopt: ''s'' superimpose' message ' ''c'' color' message ' ''m'' markers' message ' ''k'' omit key' message ' '' '' linestyle' exitm endif set ltyp 1 set plci 1 marker1 = 20 marker2 = 25 marker3 = 28 marker4 = 22 marker5 = 24 marker6 = 30 marker7 = 21 marker8 = 31 if $index([chopt],'s')=0 then if ([xmin].eq.'*') then xmin = $sigma(vmin([xvec])) endif if ([xmax].eq.'*') then xmax = $sigma(vmax([xvec])) endif if ([ymin].eq.'*') then ymin = $sigma(vmin([yvec1])) do i=2,8 vecname = yvec[i] if [%vecname].ne.0 then newmin = $sigma(vmin([%vecname])) if [newmin]<[ymin] then ymin = [newmin] endif endif enddo endif else xmin = vplotxmin xmax = vplotxmax ymin = vplotymin ymax = vplotymax xkeypos = vplotxkeypos ykeypos = vplotykeypos endif if ([ymax].eq.'*') then ymax = $sigma(vmax([yvec1])) do i=2,8 vecname = yvec[i] if [%vecname].ne.0 then newmax = $sigma(vmax([%vecname])) if [newmax]>[ymax] then ymax = [newmax] endif endif enddo endif if [xtitle] = '*' then xtitle = [xvec] endif if ([ytitle]='*'.and.[yvec2]=0) then ytitle = [yvec1] endif if $index([chopt],'s')=0 then null [xmin] [xmax] [ymin] [ymax] atitle [xtitle] [ytitle] alias/create vplotoffset 1 endif if vplotoffset.eq.'vplotoffset' then alias/create vplotoffset 1 endif * // v/plot [yvec1]%[xvec] chopt=cl xkey = (1-[xkeypos]) * [xmin] + [xkeypos] * [xmax] ydkey = 0.06 * ([ymax]-[ymin]) linetype = vplotoffset ykey = [ykeypos]* [ymax] + (1-[ykeypos]) * [ymin] - [ydkey]*([linetype]-1) yvec9 = 0 do i=1,9 vecname = yvec[i] if [%vecname].eq.0 then nextline = vplotoffset + 1 alias/create vplotoffset [nextline] alias/create vplotxmin [xmin] alias/create vplotxmax [xmax] alias/create vplotymin [ymin] alias/create vplotymax [ymax] alias/create vplotxkeypos [xkeypos] alias/create vplotykeypos [ykeypos] exitm endif if $index([chopt],'c')=0 then set ltyp [linetype] else set plci [linetype] endif pline $vdim([xvec],1) [xvec] [%vecname] chopt=cls if $index([chopt],'m')>0 then markerx = marker[linetype] set mtyp [%markerx] v/plot [%vecname]%[xvec] chopt=s endif if $index([chopt],'c')=0 then keytype=[linetype] else keytype=1 endif ykey = [ykey] - [ydkey] if $index([chopt],'k')=0 then g/hplot/key [xkey] [ykey] [keytype] [%vecname] chopt='l' if $index([chopt],'m')>0 then g/hplot/key [xkey] [ykey] [%markerx] [%vecname] endif endif errvecname = yvecerr[i] if [%errvecname].ne.0 then v/create zerr($vdim([xvec])) r aerror [xvec] [%vecname] zerr zerr [%errvecname] [%errvecname] $vdim([xvec],1) endif linetype = [linetype] + 1 enddo return