Generalize and update R mass balance plotting script