function fact=plotseis(smat,t,x,vaflag,fact,flipy,kolor,hax)
% fact=plotseis(smat,t,x,vaflag,fact,flipy,kolor,hax)
%
% PLOTSEIS does a quick plot of a seismic matrix in a figure window (made
% by plotseis). It plots the columns as wiggle traces centered at their
% x coordinates. Type plotseis with no arguments for a demo.
%
% smat ... the seismic matrix to be plotted. Traces are assumed stored in
% the columns smat.
% t ... time coordinates of traces.
% ****** default 0:.002:(nrows-1)*.002 where nrows = number of rows in smat
% x ... x coordinates of the traces
% ****** default 1:ncols where ncols=number of columns *****
% vaflag ... if 0, then traces are plotted as wt (wiggle traces)
% if 1, then the traces are plotted wtva (shaded peaks)
% if 2 then reverve polarity wtva (shaded troughs)
% ****** default = 1 ******
% fact ... scaling factors. Make fact(1) bigger for bigger wiggle
% traces. fact(2) controls the overall plot scale. If not
% provided, it is computed as max(abs(smat)). To scale two
% plots the same, capture the return value from the first and
% provide is as fact(2) for the second
% ****** default 1.5 ******
% flipy ... if 1, then the y axis is reversed so that it goes from top
% of window to the bottom
% ****** default = 1 ******
% kolor ... color to plot the traces
% ****** default = [1 0 0] (red) *****
% hax ... handle of the axis to plot the seismic matrix in. If -1, then a
% new figure is created.
% ***** default = -1 *****
%
% NOTE: To scale two plots with respect to the maximum absolute value
% on the first plot, capture the return value from the first
% and provide it as the fifth argument for the second plot:
% fact=plotseis(smat1,t1,x1);
% plotseis(smat2,t2,x2,1,fact);
%
% G.F. Margrave, Aug 1995
%
% NOTE: It is illegal for you to use this software for a purpose other
% than non-profit education or research UNLESS you are employed by a CREWES
% Project sponsor. By using this software, you are agreeing to the terms
% detailed in this software's Matlab source file.
% BEGIN TERMS OF USE LICENSE
%
% This SOFTWARE is maintained by the CREWES Project at the Department
% of Geology and Geophysics of the University of Calgary, Calgary,
% Alberta, Canada. The copyright and ownership is jointly held by
% its author (identified above) and the CREWES Project. The CREWES
% project may be contacted via email at: crewesinfo@crewes.org
%
% The term 'SOFTWARE' refers to the Matlab source code, translations to
% any other computer language, or object code
%
% Terms of use of this SOFTWARE
%
% 1) Use of this SOFTWARE by any for-profit commercial organization is
% expressly forbidden unless said organization is a CREWES Project
% Sponsor.
%
% 2) A CREWES Project sponsor may use this SOFTWARE under the terms of the
% CREWES Project Sponsorship agreement.
%
% 3) A student or employee of a non-profit educational institution may
% use this SOFTWARE subject to the following terms and conditions:
% - this SOFTWARE is for teaching or research purposes only.
% - this SOFTWARE may be distributed to other students or researchers
% provided that these license terms are included.
% - reselling the SOFTWARE, or including it or any portion of it, in any
% software that will be resold is expressly forbidden.
% - transfering the SOFTWARE in any form to a commercial firm or any
% other for-profit organization is expressly forbidden.
%
% END TERMS OF USE LICENSE
if(nargin