add switch for legend