Write plot to file