I added the word markers after x1Line it works to add markers to the line chart however then the button doesnt switch back to the scatter plot again and it is stuck on the line chart.

Whereas your original code kept it switching back and forth!