Fix outdated legend and only show legend when there is output to be shown, fixes #9939
Fix outdated legend and only show legend when there is output to be shown, fixes #9939

stefangr/composer,johnstevenson/composer,stof/composer,nicolas-grekas/composer,milleruk/composer,composer/composer,alcohol/composer,staabm/composer