function replot(X,Y,Z,pltfcn,varargin)


switch pltfcn
    case 'plot'
        if isempty(Y)
            for ix=1:size(X,2)
            plot(X(:,ix),varargin);hold on;
            end
        else
            for ix=size(X,2)
            plot(X(:,ix),Y(:,iy),varargin);hold on;
            end
        end
    case 'plotyy'
            plotyy(X(:,1),Y(:,1),X(:,2),Y(:,2),varargin);
    case 'plot3'
             plot3(X,Y,Z,varargin);
    case 'loglog'
    case 'semilogx'
    case 'semilogy'
    case 'stem'
    case 'stairs'
    case 'stem3'
    case 'scatter'
    case 'scatter3'  
    case 'contour'
    case 'contourf'
    case 'contourc'
    case 'contour3'
    case 'contourslice'
    case 'surf'
    case 'surfc'
    case 'surface'
    case 'surfl'
    case 'surfnorm'
    case 'mesh'
    case 'meshc'
    case 'meshz'
    case 'waterfall'
    case 'ribbon'
    case 'imagesc'
        imagesc(X);
end
