'plot the GPS coordinates on ox.plot_graph

I have a GPS point, say (39.6654413, 20.8586396), then i can get the graph with method in OSMNx: ox.graph_from_point. I note that ox.plot_graph can plot this graph. My problem is can i plot the GPS point on this graph ?



Solution 1:[1]

Yes. Per the documentation, the plot_graph function returns a matplotlib figure and axis as a tuple. You can use that axis object to plot a point as per normal with matplotlib.

Solution 2:[2]

Let ogp is your ox.graph_from_point then you may try something like this:

lat,lon =  (39.6654413, 20.8586396)
fig, ax = ox.plot_graph(ogp, show=False, close=False,node_alpha=.2,edge_alpha=.3, 
bgcolor='w',node_color='b', node_size=1)
plt.plot(lon,lat,c='b',marker='o')
plt.show()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gboeing
Solution 2 Subhrasankha Dey