function plotirregular(data,x,nbins)
% plots irregularly spaced data with imagesc placing data into bins
% at the approximate correct position specified by x array.
%
% arguments:
%  data - data matrix assumed to be seismograms stored in columns
%  x - parallel array to data containing offset values for data column
%    members.  that is x(i) is taken to be the offset for seismic\
%    data in the column data(:,i). 
%  nbins - number of column bins to use to create display.  
%
%  x and data must have matching sizes.  Data do not need to be sorted
% in x order.
%
dsize=size(data);
xsize=size(x);
if(xsize(1)~=dsize(2))
    'Columns in data array must equal rows in x'
    xsize(1)
    dsize(2)
    return
end

img=zeros(dsize(1),nbins);
x0=min(x);
xmax=max(x);
dx=(xmax-x0)/nbins;
dxbias=3.0*dx/2.0;
for i=1:dsize(2)
    ix=int32( (x(i)+dxbias-x0)/dx );
    img(:,ix)=data(:,i);
end
imagesc(img)