% program to read and plot climate series clear all % clears all variables previously assigned % data files have been edited to include only years common to both % load data files load blue_hills_temp.txt; load blue_hills_precip.txt; % assign columns of loaded data arrays to vectors time, temp, and precip time=blue_hills_temp(:,1); temp=blue_hills_temp(:,2); precip=blue_hills_precip(:,2); % close old figure windows close all % open figure window for temperature plot, create and label plot figure plot(time,temp,'o-') % hold this plot for precipitation plot on same axis hold % plot precipitation vs time plot(precip,time,'*-') % create a legend and label axes legend('Temperature','Precipitation') xlabel('Year') ylabel('Annual temperature [deg F] and precipitation [in]') title('Blue Hills Temperature and Precipitation') % open figure window for plots, create and label plots figure subplot(1,2,1), plot(time,temp) xlabel('Year') ylabel('Average Yearly Temperature [deg F]') title('Blue Hills Temperature') subplot(1,2,2), plot(time, precip) xlabel('Year') ylabel('Annual precipitation [in]') title('Blue Hills Precipitation') % open figure window for temp. vs. precip. scatter plot, create and label plot figure plot(precip,temp,'o') xlabel('Annual precipitation, in') ylabel('Annual temperature, deg F') title('Blue Hills Precipitation vs. Temperature')