add diagnostic plot function