Removed loops to build legend, replaced by adding plot to scope