function stairs2(x, y, continuity, line_marker)
% Plots the stairs but without the vertical lines.
%
%STAIRS2(X,Y,CONTINUITY)
%   X   Vector of x-coordinates
%   Y   Vector of y values for each stair
%   CONTINUITY  'left', 'right' or 'none' to highlight the points
%               of discontinuity
%   LINE_MARKER String to specify the line marker
%
%Example usage:
%   A = [1 2 3 4]; B = [1 2 3]; stairs2(A,B);
%   Creates three lines given by points [x, y]:
%       [1, 1] and [2, 1]
%       [2, 2] and [3, 2]
%       [3, 3] and [4, 3]

%% Input parameter's handling
if nargin < 4; line_marker = 'default'; end
if nargin < 3; continuity = 'none'; end

%% Plotting
n = length(x)-1;
A = zeros(2, n);
B = A;
for i = 1:n
    A(:,i) = [x(i); x(i+1)];
    B(:,i) = [y(i); y(i)];
end

if strcmp(line_marker, 'default')
    color = rand([1 3]);
    plot(A,B,'Color',color);
else
    plot(A,B,line_marker)
end

if ~strcmp(continuity, 'none')
    hold on;
    marker_size = 20;
    if strcmp(line_marker, 'default')
        marker_face_color = color;
        marker_edge_color = color;
    else
        marker_face_color = [1 0 0];
        marker_edge_color = [1 0 0];
    end
    if strcmp(continuity, 'left')
        scatter(A(1,:),B(1,:),marker_size,'o', ...
            'MarkerFaceColor',marker_face_color, ...
            'MarkerEdgeColor',marker_edge_color); hold on;
        scatter(A(2,:),B(2,:),marker_size,'o', ...
            'MarkerEdgeColor',marker_edge_color)
    elseif strcmp(continuity, 'right')
        scatter(A(1,:),B(1,:),marker_size,'o', ...
            'MarkerEdgeColor',marker_edge_color); hold on;
        scatter(A(2,:),B(2,:),marker_size,'o', ...
            'MarkerFaceColor',marker_face_color, ...
            'MarkerEdgeColor',marker_edge_color)
    end
end
    
    
