added options to show or hide legends