draw graph funciton