add figure function