updating visualization in each iteration