Adding data to plots#

Adding Parcels to Plots#

shift.add_parcels_to_plot(parcels: list[ParcelModel], plot_manager: PlotManager, name: str = 'Polygon Parcels')#

Plots given list of parcels.

Parameters:
  • parcels (list[ParcelModel]) – List of parcels to plot

  • plot_manager (PlotManager) – Plot manager instance

  • name (str) – Name of the plot.

Examples

>>> from shift import PlotManager
>>> plt_instance = PlotManager(GeoLocation(0, 0))
>>> add_parcels_to_plots(
    parcels=[ParcelModel(name="parcel-1", geometry=GeoLocation(0, 0))],
    plot_manager=plt_instance
    )

Adding Network to Plots#

shift.add_xy_network_to_plot(graph: Graph, plot_manager: PlotManager, name: str = 'Graph nodes')#

Function to plot xy network.

Assumes longitude is availabe as x and latitude is available as y.

Parameters:
  • graph (nx.Graph) – Instance of the graph.

  • plot_manager (PlotManager) – PlotManager Instance.

  • name (str) – Name of the plot.

Examples

>>> import networkx as nx
>>> from shift import PlotManager, GeoLocation
>>> graph = nx.Graph()
>>> graph.add_node("node1", x=-97.332, y=43.223)
>>> graph.add_node("node2", x=-97.334, y=43.334)
>>> graph.add_edge("node1", "node2")
>>> plt_instance = PlotManager(GeoLocation(-97.332, 43.223))
>>> add_xy_network_to_plots(graph, plt_instance)
>>> plt_instance.show()