new function for plot