Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated visualization functionality #144

Open
smmaurer opened this issue Aug 7, 2020 · 5 comments
Open

Updated visualization functionality #144

smmaurer opened this issue Aug 7, 2020 · 5 comments

Comments

@smmaurer
Copy link
Member

smmaurer commented Aug 7, 2020

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?

  1. Additional demos showing how to plot nodes and edges directly.

  2. 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.

  3. Better interoperability with the NetworkX data format, which would allow Pandana users to take advantage of the extensive visualization functionality in libraries like OSMnx.

@smmaurer
Copy link
Member Author

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.

@fillipefeitosa
Copy link
Contributor

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?

@smmaurer
Copy link
Member Author

smmaurer commented Sep 8, 2020

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.

@fillipefeitosa
Copy link
Contributor

Thanks for sharing. I will check everything (the code and the options you gave) and get back to you here soon.

@fillipefeitosa
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants