This is an example of how to create an line plot with legend in MATLAB®.
Read about the plot function in the MATLAB® documentation.
Go to MATLAB Plot Gallery
% Load data for the stock indices load IndexData dates values series; % Plot the stock index values versus time figure; plot(dates, values); % Use dateticks for the x axis datetick('x'); % Add title and axis labels xlabel('Date'); ylabel('Index Value'); title ('Relative Daily Index Closings'); % Add a legend in the top, left corner legend(series, 'Location', 'NorthWest');
