added an object(plot_state) to hold all the plotting states