toDot whenever the button is called