added function to sum corresponding values, plot