andy added code for median graph