def plot_as_routes(route_shapes, ax=None, spatial_bounds=None, map_alpha=<NUM_LIT>, plot_scalebar=True, legend=True,<EOL>return_smopy_map=False, line_width_attribute=None, line_width_scale=<NUM_LIT:1.0>, map_style=None):
lon_min = spatial_bounds['<STR_LIT>']<EOL>lon_max = spatial_bounds['<STR_LIT>']<EOL>lat_min = spatial_bounds['<STR_LIT>']<EOL>lat_max = spatial_bounds['<STR_LIT>']<EOL>if ax is None:<EOL><INDENT>fig = plt.figure()<EOL>ax = fig.add_subplot(<NUM_LIT>)<EOL><DEDENT>smopy_map = get_smopy_map(lon_min, lon_max, lat_min, lat_max, map_style=map_style)<EOL>ax = smopy_map.show_mpl(figsize=None, ax=ax, alpha=map_alpha)<EOL>bound_pixel_xs, bound_pixel_ys = smopy_map.to_pixels(numpy.array([lat_min, lat_max]),<EOL>numpy.array([lon_min, lon_max]))<EOL>route_types_to_lines = {}<EOL>for shape in route_shapes:<EOL><INDENT>route_type = ROUTE_TYPE_CONVERSION[shape['<STR_LIT:type>']]<EOL>lats = numpy.array(shape['<STR_LIT>'])<EOL>lons = numpy.array(shape['<STR_LIT>'])<EOL>if line_width_attribute:<EOL><INDENT>line_width = line_width_scale * shape[line_width_attribute]<EOL><DEDENT>else:<EOL><INDENT>line_width = <NUM_LIT:1><EOL><DEDENT>xs, ys = smopy_map.to_pixels(lats, lons)<EOL>line, = ax.plot(xs, ys, linewidth=line_width, color=ROUTE_TYPE_TO_COLOR[route_type], zorder=ROUTE_TYPE_TO_ZORDER[route_type])<EOL>route_types_to_lines[route_type] = line<EOL><DEDENT>if legend:<EOL><INDENT>lines = list(route_types_to_lines.values())<EOL>labels = [ROUTE_TYPE_TO_SHORT_DESCRIPTION[route_type] for route_type in route_types_to_lines.keys()]<EOL>ax.legend(lines, labels, loc="<STR_LIT>")<EOL><DEDENT>if plot_scalebar:<EOL><INDENT>_add_scale_bar(ax, lat_max, lon_min, lon_max, bound_pixel_xs.max() - bound_pixel_xs.min())<EOL><DEDENT>ax.set_xticks([])<EOL>ax.set_yticks([])<EOL>ax.set_xlim(bound_pixel_xs.min(), bound_pixel_xs.max())<EOL>ax.set_ylim(bound_pixel_ys.max(), bound_pixel_ys.min())<EOL>if return_smopy_map:<EOL><INDENT>return ax, smopy_map<EOL><DEDENT>else:<EOL><INDENT>return ax<EOL><DEDENT>
Parameters
----------
route_shapes: list of dicts that should have the following keys
        name, type, agency, lats, lons
        with types
        list, list, str, list, list
ax: axis object
spatial_bounds: dict
map_alpha:
plot_scalebar: bool
legend:
return_smopy_map:
line_width_attribute:
line_width_scale:

Returns
-------
ax: matplotlib.axes object