geoVeRoPy.plot module

geoVeRoPy.plot.plotArcs(arcs: dict, arcFieldName='arc', arcStartLocFieldName='startLoc', arcEndLocFieldName='endLoc', arcColor: str = 'Random', arcWidth: float = 1.0, arcLabel: str | None = None, arcStyle: str = 'solid', arcDashes: tuple = (5, 2), arrowFlag: bool = True, arrowPosition: float = 0.5, arrowHeadWidth: float = 2.0, arrowHeadLength: float = 3.0, startColor: str = 'black', endColor: str = 'black', bothEndSize: int | float = 2.0, neighborOpacity: float = 0.5, neighborEntWidth: float = 1.2, neighborEntColor: str = 'black', neighborBtwWidth: float = 1, neighborBtwColor: str = 'gray', neighborFillStyle: str = '///', xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Draw arcs

Parameters:
  • arcs (dict, required) – An arcs dictionary, each arc is defined by two points. See arcs for reference.

  • arcColor (string, optional, default 'Random') – Color of arcs

  • arcWidth (float, optional, default 1) – Width of arcs

  • arrowFlag (bool, optional, default True) – True if plot arrows

  • arrowHeadWidth (float, optional, default 0.1) – Width of arrow head

  • arrowHeadLength (float, optional, default 0.2) – Length of arrow head

  • fig (matplotlib object, optional, default None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • xyReverseFlag (bool, optional, default False) – True if need to reverse the x, y coordinates, e.g., plot for (lat, lon)

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • boundingBox (4-tuple, optional, default as (None, None, None, None)) – (xMin, xMax, yMin, yMax), defines four boundaries of the figure

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

Returns:

matplotlib.pyplot object

Return type:

fig, ax

geoVeRoPy.plot.plotBuildings(buildings: dict, buildingBoundary: list[list[float]] | list[tuple[float, float]] | list[list[list[float]]] | list[list[tuple[float, float]]] | None = None, buildingColors: dict[str, str] | str = {'building': 'yellow', 'commercial': 'yellow', 'house': 'green', 'industrial': 'orange', 'manufacture': 'orange', 'residential': 'green', 'static_caravan': 'green'}, buildingShowFlags: list[str, bool] | str | bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotCircle(center: list[float] | tuple[float, float], radius: float, lod: int = 30, edgeWidth: float = 0.5, edgeColor: str | None = 'Random', fillColor: str | None = None, fillStyle: str = '///', opacity: float = 0.5, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotCone3D(cone: dict, lod: int = 30, tanAlpha: float | None = None, fig=None, ax=None, boundingBox3D=(None, None, None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotGantt(gantt: list[dict], group: list[dict] | None = None, phase: list[dict] | None = None, xlabel: str = 'Time', ylabel: str = '', ganttHeight: float = 0.8, ganttLinewidth: float = 1.0, ganttBlockHeight: float = 1.0, groupSeparatorHeight: float = 0.5, groupSeparatorStyle: str = '-', groupSeparatorLinewidth: float = 0.5, groupSeparatorColor: str = 'gray', phaseSeparatorStyle: str = '--', phaseSeparatorLinewidth: float = 0.5, phaseSeparatorColor: str = 'gray', startTime: float = 0, endTime: float | None = None, fig=None, ax=None, figSize: list[int | float | None] | tuple[int | float | None, int | float | None] = (12, 5), showGridFlag: bool = False, saveFigPath: str | None = None, showTailFlag: bool = True, showFig: bool = True) Given a Gantt dictionary, plot Gantt[source]

Given a Gantt dictionary, plot a Gantt chart

Parameters:
  • gantt (list of dictionaries, required) –

    A list of dictionaries, each represents a gantt block, in the following format >>> gantt = [{

    … ‘entityID’: entityID, … ‘timeWindow’: [startTime, endTime], … ‘desc’: (optional) description of the window, … ‘color’: (optional, default as ‘random’) color, … ‘style’: (optional, default as ‘solid’) ‘solid’ … }, … ]

  • group (list of dictionaries, optional, default []) –

    Groups of entityIDs, in the following format
    >>> group = [{
    ...     'title': groupTitle,
    ...     'entities': [entityID1, entityID2, ...],
    ...     'showFlag': True,
    ...     'backgroundColor': 'gray',
    ...     'backgroundOpacity': 0.5
    ... }, ... ]
    

  • phase (list of dictionaries, optional, default []) –

    A list of phases, in the following format
    >>> phase = [{
    ...     'title': phaseTitle,
    ...     'timeWindow': [startTime, endTime],
    ...     'backgroundColor': 'gray',
    ...     'backgroundOpacity': 0.5
    ... }, ... ]
    

  • xlabel (string, optional, default "Time") – The label of x-axis

  • ylabel (string, optional, default "") – The label of y-axis

  • fig (matplotlib object, optional, default None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • showGridFlag (bool, optional, default as False) – True if turn the grids on.

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

geoVeRoPy.plot.plotLocSeq(locSeq: list[list[float] | tuple[float, float]], lineColor: str = 'Random', lineWidth: float = 1.0, lineStyle: str = 'solid', lineDashes: tuple = (5, 2), nodeColor: str = 'black', nodeMarkerSize: float = 1, arrowFlag: bool = True, arrowPosition: float = 0.5, arrowHeadWidth: float = 0.1, arrowHeadLength: float = 0.2, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Given a list of coordinates, plot a open polyline by sequences.

Parameters:
  • locSeq (list[pt], required) – A list of coordinates to form a sequence

  • lineColor (string, optional, default 'Random') – Color of lines

  • lineWidth (float, optional, default 1) – Width of lines

  • arrowFlag (bool, optional, default True) – True if plot arrows

  • arrowHeadWidth (float, optional, default 0.1) – Width of arrow head

  • arrowHeadLength (float, optional, default 0.2) – Length of arrow head

  • xyReverseFlag (bool, optional, default False) – True if need to reverse the x, y coordinates, e.g., plot for (lat, lon)

  • fig (matplotlib object, optional, default None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • boundingBox (4-tuple, optional, default as (None, None, None, None)) – (xMin, xMax, yMin, yMax), defines four boundaries of the figure

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

Returns:

fig, ax

Return type:

matplotlib.pyplot object

geoVeRoPy.plot.plotLocSeq3D(locSeq3D: list[list[float] | tuple[float, float, float]], lineColor: str = 'Random', lineWidth: float = 1.0, lineStyle: str = 'solid', lineDashes: tuple = (5, 2), nodeColor: str = 'black', nodeMarkerSize: float = 1, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox3D=(None, None, None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotLocs(locs: list[list[float] | tuple[float, float]], locColor: str = 'Random', locMarker: str = 'o', locMarkerSize: float = 1, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Plot locations on a figure

Parameters:
  • locs (list of pt, required) – A list of locations to be plotted

  • locColor (str, optional, default as 'Random') – The color of locations to be plotted, ‘Random’ if the color is randomized.

  • locMarker (str, optional, default as 'o') – The shape of the marker

  • locMarkerSize (str, optional, default as 1) – The size of the marker

  • xyReverseFlag (bool, optional, default as False) – Reverse the x, y, (x, y) => (y, x). Used in plotting (lat, lon) coordinates.

  • fig (matplotlib object, optional, default as None) – If fig and ax are provided,

geoVeRoPy.plot.plotLocs3D(locs3D: list[list[float] | tuple[float, float, float]], locColor: str = 'Random', locMarker: str = 'o', locMarkerSize: float = 1, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox3D=(None, None, None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotNodeSeq(nodes: dict, nodeSeq: list[int | str], locFieldName: str = 'loc', lineColor: str = 'Random', lineWidth: float = 1, lineStyle: str = 'solid', lineDashes: tuple = (5, 2), nodeColor: str = 'black', nodeMarkerSize: float = 1, arrowFlag: bool = True, arrowPosition: float = 0.5, arrowHeadWidth: float = 0.1, arrowHeadLength: float = 0.2, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Given a nodes dictionary and a sequence of node IDs, plot a route that visits each node by IDs.

Parameters:
  • nodes (dict, required) – A node dictionary. See nodes for reference.

  • nodeSeq (list[int|str], required) – A list of nodeIDs which will form a visiting sequence

  • arcColor (string, optional, default 'Random') – Color of arcs

  • arcWidth (float, optional, default 1) – Width of arcs

  • arrowFlag (bool, optional, default True) – True if plot arrows

  • arrowHeadWidth (float, optional, default 0.1) – Width of arrow head

  • arrowHeadLength (float, optional, default 0.2) – Length of arrow head

  • xyReverseFlag (bool, optional, default False) – True if need to reverse the x, y coordinates, e.g., plot for (lat, lon)

  • fig (matplotlib object, optional, default None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • boundingBox (4-tuple, optional, default as (None, None, None, None)) – (xMin, xMax, yMin, yMax), defines four boundaries of the figure

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

Returns:

fig, ax

Return type:

matplotlib.pyplot object

geoVeRoPy.plot.plotNodes(nodes: dict, locFieldName='loc', nodeColor: str = 'Random', nodeMarker: str = 'o', nodeMarkerSize: float = 1, neighborFieldName='neighbor', neighborColor: str | None = 'gray', neighborOpacity: float = 0.5, neighborFillStyle: str = '///', xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Draw nodes

Parameters:
  • nodes (dictionary, required) – A nodes dictionary. See nodes for reference.

  • locFieldName (str, optional, default as 'loc') – The key value in nodes indicating the location of each node.

  • nodeColor (str, optional, default 'Random') – Alternative option. If ‘color’ is provided in nodes, this field will be ignored.

  • nodeMarker (str, optional, default 'o') – Alternative option for node marker. If ‘marker’ is provided in nodes, this field will be ignored.

  • nodeMarker – Alternative option for node marker size. If ‘markerSize’ is provided in nodes, this field will be ignored.

  • neighborColor (str, optional, default 'gray') – If nodes have ‘neighbor’ label, will plot the neighbor area in this color

  • neighborOpacity (float, optional, default 0.5) – The opacity of neighborhood.

  • neighborFillStyle (str, optional, default '///') – The fill style of the neighborhood.

  • xyReverseFlag (bool, optional, default False) – True if need to reverse the x, y coordinates, e.g., plot for (lat, lon)

  • fig (matplotlib object, optional, defaut None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • boundingBox (4-tuple, optional, default as (None, None, None, None)) – (xMin, xMax, yMin, yMax), defines four boundaries of the figure

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

Returns:

matplotlib.pyplot object

Return type:

fig, ax

geoVeRoPy.plot.plotPoly(poly: list[list[float]] | list[tuple[float, float]], edgeWidth: float = 0.5, edgeColor: str | None = 'Random', fillColor: str | None = None, fillStyle: str = '///', opacity: float = 0.5, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]

Draw a polygon

Parameters:
  • poly (poly, required, default None) – A polygon to be plotted

  • edgeWidth (float, optional, default 0.5) – Width of the edge

  • edgeColor (string, optional, default 'Random') – Color of the edge

  • fillColor (string, optional, default None) – Color filled in the polygon

  • fillStyle (string, optional, default "///") – Style filled in the polygon

  • opacity (float, optional, default 0.5) – Opacity of the polygon

  • xyReverseFlag (bool, optional, default False) – True if need to reverse the x, y coordinates, e.g., plot for (lat, lon)

  • fig (matplotlib object, optional, defaut None) – fig and ax indicates the matplotlib object to plot on, if not provided, plot in a new figure

  • ax (matplotlib object, optional, default None) – See fig

  • figSize (2-tuple, optional, default as (None, 5)) – Size of the figure in (width, height). If width or height is set to be None, it will be auto-adjusted.

  • boundingBox (4-tuple, optional, default as (None, None, None, None)) – (xMin, xMax, yMin, yMax), defines four boundaries of the figure

  • saveFigPath (string, optional, default as None) – The path for exporting image if provided

  • showFig (bool, optional, default as True) – True if show the figure in Juypter Notebook environment

Returns:

fig, ax

Return type:

matplotlib.pyplot object

geoVeRoPy.plot.plotPolygons(polygons: dict, polyFieldName: str = 'poly', showAnchorFlag: bool = True, anchorFieldName: str = 'anchor', edgeWidth: float = 0.5, edgeColor: str | None = 'Random', fillColor: str | None = None, fillStyle: str = '///', opacity: float = 0.5, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotPolyhedron3D(polyhedron: list[list[float]] | list[tuple[float, float]], edgeWidth: float = 0.5, edgeColor: str | None = 'Random', fillColor: str | None = None, fillStyle: str = '///', opacity: float = 0.5, xyReverseFlag: bool = False, fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotProvinceMap(province: list[str] | str = [], edgeWidth: float = 0.5, edgeColor: str = 'Random', fillColor: str | None = None, fillStyle: str = '///', opacity: float = 0.5, showAnchorFlag=False, fig=None, ax=None, figSize: list[int | float | None] | tuple[int | float | None, int | float | None] = (None, 5), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]
geoVeRoPy.plot.plotRoads(roads: dict, roadBoundary: list[list[float]] | list[tuple[float, float]] | list[list[list[float]]] | list[list[tuple[float, float]]] | None = None, roadWidth: dict[str, float] | float = {'motorway': 2, 'motorway_link': 2, 'others': 0.8, 'primary': 1.2, 'primary_link': 1.2, 'residential': 0.8, 'secondary': 1, 'secondary_link': 1, 'tertiary': 1, 'tertiary_link': 1, 'truck': 1.5, 'truck_link': 1.5}, roadColors: dict[str, str] | str = {'motorway': 'red', 'motorway_link': 'red', 'others': 'gray', 'primary': 'orange', 'primary_link': 'orange', 'residential': 'green', 'secondary': 'orange', 'secondary_link': 'orange', 'tertiary': 'orange', 'tertiary_link': 'orange', 'truck': 'orange', 'truck_link': 'orange'}, roadShowFlags: list[str, bool] | str | bool = 'All', fig=None, ax=None, figSize=(None, 5), boundingBox=(None, None, None, None), showAxis: bool = True, saveFigPath: str | None = None, showFig: bool = True)[source]