function func_csolidline(x,y,plottype,linestyle,linewidth)

% CSOLIDLINE Color solid line plot
%   CSOLIDLINE(X,Y) plots vector Y versus vector X with color solid line.
%   CSOLIDLINE(X,Y,plottype,linestyle,linewidth)
%       plottype is
%           'plot' : color plot
%           'stairs' : color stairs
%           'nc_plot' : no color plot
%           'nc_stairs' : no color stairs (default)
%       linestyle is line style, default is '-'
%       linewidth is line width, default is 1
%	written by: Kelvin Leung, Principal Engineer, MKS Instruments
%	last modified: 8-26-2017

if nargin < 3
    plottype = 'nc_stairs';
    linestyle = '-';
    linewidth = 1;
elseif nargin < 4
    linestyle = '-';
    linewidth = 1;
elseif nargin < 5
    linewidth = 1;
end

% handle no colar plot request
switch plottype
    case 'nc_plot'
        plot(x,y,linestyle,'LineWidth',linewidth);
        return;
    case 'nc_stairs'
        stairs(x,y,linestyle,'LineWidth',linewidth);
        return;
end

% limit the color segment to 256 in color solid line plot
segment_limit = 256;
if length(x) < segment_limit
    segment = length(x);
else
    segment = segment_limit;
end

pattern = jet(segment);
for i = 1: segment
    i_b = 1+round((i-1)*length(x)/segment); % calculate start index
    i_e = min(1+round((i)*length(x)/segment),length(x));    % calculate stop index and limit it value to length(x)
    hold on;
    switch plottype
        case 'plot'
            plot(x(i_b:i_e),y(i_b:i_e),linestyle,'color',pattern(i,:),'LineWidth',linewidth);
        case 'stairs'
            stairs(x(i_b:i_e),y(i_b:i_e),linestyle,'color',pattern(i,:),'LineWidth',linewidth);
    end
end