Auto save all figures and write histogram txt data