% multi_plot.m % Example for plotting several sets of data on a single graph % adapted from http://web.cecs.pdx.edu/~gerry/MATLAB/plotting/loadingPlotData.html % BJ Furman % 15NOV2009 % read data into PDXtemperature matrix load('PDXtemperature.dat'); % copy first column of PDXtemperature into month month = PDXtemperature(:,1); % and second column into high_temp high_temp = PDXtemperature(:,2); % and third column into low temp low_temp = PDXtemperature(:,3); % and fourth column into avg temp avg = PDXtemperature(:,4); % generate the plot plot(month,high_temp,'ko',month,low_temp,'k+',month,avg,'k-'); % add axis labels and plot title xlabel('Month'); ylabel('temperature (degrees F)'); title('Monthly average temperature for Portland International Airport'); % add a plot legend using labels read from the file legend('High','Low','Avg'); grid on