add auto-generated legend