code for visualization