Refactor function to read and plot polygon coordinates