I have a osmnx plot that has two routes, but the map is quite vast therefore I cannot see the routes properly. Is there a fast way to limit my plot, to sort of 'zoom in', using for example bbox
? I know I could search for districts instead of a whole city, I was just curious to know if there was a fastest way to 'zoom' in the plot.
Here is the code:
import osmnx as ox
import igraph as ig
import matplotlib.pyplot as plt
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib as mpl
import random as rd
from IPython.display import clear_output
import matplotlib.cm as cm
ox.config(log_console=True, use_cache=True)
%%time
city = 'Portugal, Lisbon'
G = ox.graph_from_place(city, network_type='drive', simplify=True)
G_nx = nx.relabel.convert_node_labels_to_integers(G)
weight = 'length'
nodes, edges = ox.graph_to_gdfs(G_nx, nodes=True, edges=True)
origin = [8371, 5983, 6301, 9086]
orig = origin[1]
dest = 9590
route_1 = nx.shortest_path(G_nx, orig, dest, weight='length')
route_2 = nx.shortest_path(G_nx, dest, orig, weight='length')
fig, ax = ox.plot_graph_routes(G_nx, routes=[route_1, route_2], route_colors=['r', 'y'],
route_linewidth=6, node_size=0, figsize=(20,20))
Here is the plot: