pandana
pandana copied to clipboard
Updated visualization functionality
Pandana's network.plot()
function is more or less broken; it relies on a Matplotlib extension called Basemap that's deprecated and now very hard to install. This has been discussed previously in issues #70, #71, #110, and probably others.
cc @sablanchard @PyMap
Current solution
You can easily visualize a Pandana network's nodes directly. See the newly updated demo notebook for an example: Pandana-demo.ipynb.
Future work
Regardless, it would be nice to do more to facilitate visualization. Maybe some combination of the following?
-
Additional demos showing how to plot nodes and edges directly.
-
Drop the basemap layer from the
network.plot()
function, so that it's only using core Matplotlib. Perhaps make it optional to include a basemap layer using CartoPy, which is the designated replacement for Matplotlib's Basemap extension. -
Better interoperability with the NetworkX data format, which would allow Pandana users to take advantage of the extensive visualization functionality in libraries like OSMnx.
From discussion with @sablanchard:
-
UrbanAccess also has functionality for plotting Pandana networks -- docs, code. It doesn't use
basemap
so it's still a good option. -
And given that there are multiple UDST libraries that work with spatial/network data, we might also want to set up a stand-alone library for visualization that could be tapped by all of them. For example, there's a udtk ("UrbanSim Data Toolkit") repo that already has some rough functionality like this.
updated my environment and got stuck with this error. Took me a while to find out about basemap deprecation in favor of Cartopy. Checking the link provided by OP.
As a user point of view, would be great to still have the network.plot() functionality. Is there something I could do help?
Hi @fillipefeitosa, thanks for the offer!
Want to try adjusting network.plot()
so that it doesn't use a basemap layer? I think that's the simplest way forward. Here's the relevant code: network.py#L482-L564
Ideally we should keep the same input parameters and return value order, to avoid breaking people's downstream code. At the bottom of this notebook is a working example of plotting a Pandana network without a basemap, using the current Matplotlib: Pandana-demo.ipynb
And I think this demo from the UrbanAccess library has an example of using CartoPy to add a basemap layer. @sablanchard updated it just a few weeks ago: urbanaccess/simple_example.ipynb
It would be nice to include a CartoPy basemap as an option in network.plot()
-- but we probably shouldn't make it the default, because CartoPy can be tricky to install as well.
Thanks for sharing. I will check everything (the code and the options you gave) and get back to you here soon.
I just PR citing this discussion.
Spent some time reading cartpy Docs. I think it is a great option to add in plot() as option. Soon as I figure it out, I PR again.