updated the analyze macro to help the plotting macro