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

Update plot_network to use the geopandas plotting API in place of the networkx plotting API #451

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kbonney
Copy link
Collaborator

@kbonney kbonney commented Oct 1, 2024

Summary

This PR updates the plot_network function by replacing networkx plotting functions with geopandas plotting functions. This builds on the geospatial capabilities of wntr by using the GeoDataFrames generated by to_gis() to interface with the geopandas plotting capabilities. This update reduces the complexity of the plotting code, making it easier to maintain and opening opportunities for other plotting options.

These updates aim to minimize changes to the output of plot_network, except where changes add functionality.
The arguments of plot_network remain unchanged, with the exception of some additional keyword arguments with defaults, so these updates should be fully backwards compatible.

New functionality includes:

  • Vertices of links are incorporated in the plot, rather than always having straight lines between junctions.
  • Valves, pumps, tanks and reservoirs are marked with distinct symbols. Direction of pumps is indicated by an arrow. (in-progress)
  • link_attribute and node_attribute string options are expanded to include attributes for all assets (pipe, valve, and pump for link and junction, tank, and reservoir for node)

Note that relying on geopandas for plotting will require elevating geopandas from an optional dependency to a required one.

This PR addresses #223 since geopandas plots the vertices, which means #390 is no longer necessary.

Tests and documentation

Current tests and documentation already cover the plot_network function.

Acknowledgement

By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.

@coveralls
Copy link

Coverage Status

coverage: 83.573% (-0.7%) from 84.227%
when pulling 487511a on kbonney:gis_plotting
into 576dc01 on USEPA:main.

…eopandas backend to handle lists for attributes and add shapes for valves and pumps.
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

Successfully merging this pull request may close these issues.

2 participants