You're doing the same check here and in `showLegend()`. One of them could be omitted.