nested the map and legend drawing