ts and box plotting functions