Fixed graph plotting on button click