% 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 % 07MAY2012 % 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 subplot(2,1,1),plot(month,high_temp,'ko',month,low_temp,'k+'); % add axis labels and plot title xlabel('Month'); ylabel('temperature (degrees F)'); title('Monthly high and low temperature for Portland International Airport'); % generate the Monthly Average Temperature plot subplot(2,1,2),plot(month,avg,'r-'); % add axis labels and plot titlexlabel('Month'); 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